Skip to content
Advertisement

ValueError: Columns must be same length as key in pandas

i have df below

JavaScript

I need to divide df['Cost'] / df['Reve']

Below is my code

JavaScript

I got the error ValueError: Columns must be same length as key

JavaScript

I got the error ValueError: Wrong number of items passed 2, placement implies 1

Advertisement

Answer

Problem is duplicated columns names, verify:

JavaScript

You can find this columns names:

JavaScript

If same values in columns is possible remove duplicated by:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement