I have the below data frame.
df3=pd.DataFrame(columns=["Devices","months"])
I am getting row value from a loop row, print(data)
Devices months
1 Powerbank Feb month
When I am adding this data row to my df3 I am getting an error.
df3.loc[len(df3)]=data
ValueError: cannot set a row with mismatched columns
use
df3 = pd.concat([df3, data], axis=0)
or as suggested by @Wen use
df3 = df3.append(data)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With