Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

loadtxt does not allow specifying a default radix #19836

Copy link
Copy link
Open
@skoehler

Description

@skoehler
Issue body actions

When processing large amount of data with Python, I rely on numpy to do the processing.
I seem to have no way of loading large text files with binary numbers in them, something like

101 11 111
110 01 000

I have found that loadtxt does handle the 0x prefix but not the 0b prefix (as available in Python), probably since you just use some strtoull function for the conversion from ASCII to numbers. On the other hand, the strtou* functions would allow me to specify a radix (2, 8, 10, 16, or even 13). This feature is currently not exposed. Also, the documentation of loadtxt does not seem to describe the currently implemented logic (how are prefixes like 0x handled? do leading zeros indicate octal literals? etc.).

I would like to propose that I can specify the default radix. Also, it would be nice if numpy would handle the typical Python prefixes (0x, 0o, 0b). Please note that this is not the out-of-the-box strtou* behavior. If given a radix, it will disable prefix detection, AFAIK.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.