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['party'] =

!! the #parties is actually a dict where data.cand_nm.unique_values is the keys and values should be Democrat or Republican

but I tried to do the math it wont work

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:

0 Answers