I'm trying to read in a csv file using pandas (0.8.1) using the dtype parameter and am having an error.
My csv file structure looks like this:
"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 the dtype is because the first two columns USAF
,WBAN
need to be string since they sometimes start with zeros, and when I read regularly it converts a number like 0006852 into 6852. Here's the code I'm using:
import pandas as pd
df = pd.io.parsers.read_csv("Station Codes.csv", dtype={'USAF': np.str, 'WBAN': np.str})
results in the following error:
TypeError: read_csv() got an unexpected keyword argument 'dtype'
I don't understand why it's saying that its an unexpected keyword argument when I see the documentation here: http://pandas.pydata.org/pandas-docs/dev/generated/pandas.io.parsers.read_csv.html
Am I missing something here?