[Tutor] Appending an extra column in a data file
Alan Gauld
alan.gauld at btinternet.com
Wed Apr 10 19:37:48 CEST 2013
On 10/04/13 16:44, Sayan Chatterjee wrote:
> I have some data files with numpy arrays stored in it in 2 columns. I
Can you define what that means?
All files on a computer are data files in some sense.
They exist as text files or binary files. If they are text files then
the content of your arrays must be encoded somehow as strings. If they
are binary files you must have dumped them to file somehow and adding
floats is something you probably need to figure out yourself!
How did you create these files? (Or how were they created buy somebody
else?)
> want to add a third column with just floating point numbers(not numpy
> array) and plot them later with Matplotlib in 3d. How is it done? Could
> you please illuminate me?
The fact you use the term column suggests that maybe they are text files
of some kind in which case you likely have the content of the numpy
arrays but not their structure, in which case adding an extra column
should be easy by following the pattern of how you created the files.
Don't forget to modify the functions that read the data back to match.
But with no idea of the exact nature of your "data files" we can't give
very specific help.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list