my dataframe has a datetime index. I can not print its info as it raises a TypeError:
import pandas as pd
from datetime import datetime
df = pd.DataFrame(data={"a": datetime.now()}, index=["a"])
print(df.info())
results in
Traceback (most recent call last):
File "example.py", line 88, in <module>
print(df.info())
File "lib/python3.8/site-packages/pandas/core/frame.py", line 2497, in info
mem_usage = self.memory_usage(index=True, deep=deep).sum()
File "lib/python3.8/site-packages/pandas/core/frame.py", line 2590, in memory_usage
result = Series(self.index.memory_usage(deep=deep), index=["Index"]).append(
File "lib/python3.8/site-packages/pandas/core/series.py", line 305, in __init__
data = sanitize_array(data, index, dtype, copy, raise_cast_failure=True)
File "lib/python3.8/site-packages/pandas/core/construction.py", line 465, in sanitize_array
subarr = construct_1d_arraylike_from_scalar(value, len(index), dtype)
File "lib/python3.8/site-packages/pandas/core/dtypes/cast.py", line 1452, in construct_1d_arraylike_from_scalar
subarr = np.empty(length, dtype=dtype)
TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type