Skip to content Skip to sidebar Skip to footer

Pandas Attributeerror: 'unicode' Object Has No Attribute 'view'

This is a killer problem that probably has a simple solution for a pandas newbie like me: I'm trying to replace one record of pandas DataFrame (df) with the latest version of that

Solution 1:

So your problem here seems to be that you had a mismatch on the dtypes between the 2 dfs you were trying to assign to and from:

df dtypes: datetime64[ns](2), float64(1), object(70) 

whilst

latest_version is :dtypes: float64(1), int64(1), object(71)

From the output we can see that that columns that clash some are datetimes, whilst they are int64's in the corresponding column in the other df.

You can convert the ill-formed columns to datetime by doing:

df['entry_date'] = pd.to_datetime(df['entry_date')

and likewise for entry_ref_a

Post a Comment for "Pandas Attributeerror: 'unicode' Object Has No Attribute 'view'"