-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loadtxt not working? #561
Comments
Thanks for raising the issue, I'll look into it. |
@NoRez4U Does the function work, if you specify the delimiter? np.loadtxt('TestData.csv', delimiter=',') I think there is a bug in the code for the default case. |
No sir, adding a delimiter did not work. So I also saved it off via savetxt() and loaded it back with loadtxt() both with 'delimiter' and 'comments' flag to see if that was tripping it up, but no joy.
However, you brought up a good point so I also tested the 'savetxt()' w/o any flags (just the save_to_file and the array to write off). 'loadtxt()' then worked...
I then tried to add each flag one at a time but it appeared that anything other than no flags errored out. |
OK, thanks for the feedback! I'll try to fix this in the next couple of days. However, since you say that the |
Maybe, but the I was trying to hunt down where the "ValueError: invalid syntax for number" was coming from. I looked in the io.c file but it's not from there (because that's where Maybe it's a MicroPython bug? I searched MicroPython "Issues" to see if they had a known bug w/ Unfortunately, that's about as high as I can punch (hope you're familiar w/the reference). I'm guessing that it might be that what All that said, I'm in no rush for this fix. Just wanted to help improve a great tool since I'm not skilled enough to help in another way. I have a workaround for now (Excel). Whenever you get it fixed is great. Thank you (all) for even making this available! |
I saved some files off using savetxt. When I try to load them back in I get a "ValueError: invalid syntax for number" error.
Expected behavior
That file was saved by this line of code:
np.savetxt(Event_File_Name, Event_Array, delimiter=',', header='Milliseconds, Raw Analog Reading', footer=Event_Time_Stamp)
My expectation is the file should load via
loadtxt
since it was saved off usingsavetxt
.The online documentation seems to support this expectation: https://micropython-ulab.readthedocs.io/en/latest/numpy-functions.html#loadtxt
To Reproduce
I made a small array at the prompt to see if it would work and it did.
So maybe the array I've written off via the program is too large to read back in (It's a [2,1200] array of dtype=np.uint16). Or do I need to tell it the file had 'header', 'footer', and/or 'delimiter'? I'll be honest that I'd feel better submitting this as a bug if the TestArray didn't work, but it did. However, I'm still feeling like this is a bug and/or undocumented/unanticipated limitation.
I've attached one of the files saved off from the program in case that helps.
SurgeEvent-2021-1-1-10226.csv
The text was updated successfully, but these errors were encountered: