Reputation: 104
After running
df = pd.read_csv('my_file.csv')
,
my original .csv file goes blank. Is there a way to read the .csv data without emptying the original file?
Upvotes: 1
Views: 163
Reputation: 4197
pd.read_csv()
does not modify the file!
Here, the file before using pd.read_csv()
:
Using it:
And now if we check it again, the file hasn't changed (as expected):
So the problem isn't with pd.read_csv()
. I would assume that you have other code that's messing things up. Take a look and tell us, so we can help you better.
Upvotes: 1