Reputation: 10813
I have some data from https://github.com/CSSEGISandData/COVID-19/blob/master/csse_covid_19_data/csse_covid_19_daily_reports/ which looks like:
Singapore,2020-04-17 23:30:32,1.2833,103.8333,5050,11,708,4331,Singapore
Singapore,2020-06-12 05:09:52,1.2833,103.8333,39387,25,27286,12076,Singapore,673.2425774010173,0.06347271942519106
When I read that with pandas, sg = pd.read_csv("singapore.csv", names=["Country_Region", "Last_Update", "Lat", "Long", "Confirmed", "Deaths","Recovered","Active"])
it bizarrely looks like:
It would look like the CSV is not properly read... why?
Bonus: How do I "clean" data that has added columns to a data structure like what has happened between here and here.
https://github.com/kaihendry/covid19-sg/blob/master/pandas.ipynb
Upvotes: 0
Views: 1258
Reputation: 1794
You need to tell pandas not to use the first column as the index by passing: index_col=False
to your read_csv()
call.
That will resolve the "bizarre" data.
Upvotes: 10