Python Pandas adds column header as entry instead of actual data after adding new column Python Pandas adds column header as entry instead of actual data after adding new column pandas pandas

Python Pandas adds column header as entry instead of actual data after adding new column


It's a problem with the datatypes. When you create a dataframe without specifying any data, it automatically assigns datatype object to all columns.

Create your dataframe like this:

df = pd.DataFrame(columns=('A', 'B', 'C'), index=range(5), data=0)