Reading Data from a File
(outline goes here)
start
- the file data.txt contains data stored in a text file
- load the data into Python and plot x vs. y
- use the command data=io.read_array('data.txt',separator='\t')
- note that if you type data at the prompt and hit enter, the first row of your matrix is [0, 0]. This is because Python didn't know what to do with the column labels in the txt file. Try this instead:
- data=io.read_array('data.txt',separator='\t', lines=(1,-1))
- lines=(1,-1) tells Python to throw away the zeroth row