At first, I tried to read some CSV file by Pandas. However, I encountered the error:
DtypeWarning: Columns (6) have mixed types. Specify dtype option on import or set low_memory=False.
Then I try this:
data=pd.read_csv('ALL.csv',dtype=object) which works wonderfully.
My further code:
data=pd.read_csv('ALL.csv',dtype=Object) data['party'] = data.cand_nm.map(parties) sort_by_occupation=data.pivot_table('contb_receipt_amt',index='contbr_occupation',columns='party',aggfunc='sum')
!! the #parties is actually a dict where
data.cand_nm.unique_values is the keys and values should be
Democrat or Republican
because the type of value is Object not integer:
This is my trial
I have the error:
OverflowError: Python int too large to convert to C long
Someone told me about int64 bit but personally, still not very clear about that. Would appreciate any helps along with some explanations.
For your information of dataset: https://raw.githubusercontent.com/benrolfs/pydata/master/ch09/P00000001-ALL.csv