I am trying to read a csv file using pandas using the dtype parameter and have an error.
My csv file structure is as follows:
"USAF","WBAN","STATION NAME","CTRY","FIPS","STATE","CALL","LAT","LON","ELEV(.1M)","BEGIN","END" "006852","99999","SENT","SW","SZ","","","+46817","+010350","+14200","","" "007005","99999","CWOS 07005","","","","","-99999","-999999","-99999","20120127","20120127"
The reason I need to specify dtype is because the first two columns sometimes start with zeros, and when I read regularly, it converts the number, for example 0006852, to 6852. Here is the code that I use:
import pandas as pd df = pd.io.parsers.read_csv("Station Codes.csv",dtype={'USAF': np.str, 'WBAN': np.str})
leads to the following error:
TypeError: read_csv() got an unexpected keyword argument 'dtype'
I don't understand why he says his unexpected keyword argument when I see the documentation here: http://pandas.pydata.org/pandas-docs/dev/generated/pandas.io.parsers.read_csv.html
Did I miss something?