An error occurred while initializing an empty dataframe
Traceback (most recent call last):
result_format = pd.DataFrame(index=index, columns=columns)
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py", line 435, in __init__
mgr = init_dict(data, index, columns, dtype=dtype)
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 239, in init_dict
val = construct_1d_arraylike_from_scalar(np.nan, len(index), nan_dtype)
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\dtypes\cast.py", line 1440, in construct_1d_arraylike_from_scalar
dtype = dtype.dtype
AttributeError: type object 'object' has no attribute 'dtype'
Solution:
result_format = pd.DataFrame(index=index, columns=columns, dtype=object)
Read More:
- Python: How to Reshape the data in Pandas DataFrame
- [Solved] Pandas dataframe merge error: Different types cannot be merged
- [Solved] AttributeError: ‘DataFrame‘ object has no attribute ‘tolist‘
- [Solved] AttributeError: ‘DataFrame‘ object has no attribute ‘map‘
- [Solved] AttributeError: DataFrame object has no attribute’xxx’
- Error reading file by pandas pandas.errors.EmptyDataError: no columns to parse from file
- Pandas read_csv pandas.errors.ParserError: Error tokenizing data
- Pandas Error: ValueError: setting an array element with a sequence.
- Python Pandas Typeerror: invalid type comparison
- [Solved] pandas ExcelWrite AttributeError: ‘NoneType‘ object has no attribute ‘group‘
- [Solved] AttributeError: module ‘pandas‘ has no attribute ‘rolling_count‘
- Python Pandas Error: KeyError: 0 [How to Solve]
- [Solved] ParserError: NULL byte detected. This byte cannot be processed in Python‘s native csv library
- [Solved] Pandas rename Error: ValueError: operands could not be broadcast together with shapes (1,2) (3,) (1,2)
- [Solved] Python Pandas Read Error: OSError: initializing from file failed
- [How to Fix]pandas.errors.ParserError: Error tokenizing data
- Python+ Pandas + Evaluation of Music Equipment over the years (Notes)
- Pandas uses str.contains to filter error [How to Solve]
- Python Pandas Error: No module named ‘openpyxl‘
- Pandas ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.an