I used pandas to load data from a dataSource.cvs
file:
DF = pd.read_csv('dataSoruce.csv')
In pandas I can clean the data, like filling missing values with 0.
Next I use DF.to_csv('temp.csv', sep=',')
to write the DF
as a
temporary cvs file, and then use the python file handler to open the file again
hd = open('temp.csv')
for line in hd:
line = line.split(',').....
to parse the data and associate more information from other data tables. This works. However, if I directly doing
hd = DF
Then it shows the error message as
IndexError: list index out of range
Are there any ways to skip saving to cvs and reading csv?
i.e. directly open the pandas dataFrame
as a file handler?
A ton of thanks!