I'm trying to pivot a dataframe but it keeps returning an Int64 Error. A similar question was not actually answered - What causes these Int64 columns to cause a TypeError?
Here's the type of my dataframe:
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 price 30159 non-null Int64
1 type 30159 non-null object
2 size 30155 non-null Int64
3 location 30159 non-null object
4 neighborhood 30159 non-null object
dtypes: Int64(2), object(3)
the pivot table code:
pfraw = pd.pivot_table(pfraw, values = 'price', index = 'neighborhood', columns = 'type')
and the lat bit of the error message:
273 dtype = np.dtype(dtype)
275 if not isinstance(dtype, np.dtype):
276 # enforce our signature annotation
--> 277 raise TypeError(dtype) # pragma: no cover
279 converted = maybe_downcast_numeric(result, dtype, do_round)
280 if converted is not result:
TypeError: Int64
I dont understand why would it return an error with Int64.