79089791

Date: 2024-10-15 11:57:35
Score: 0.5
Natty:
Report link

Example

pandas drop function is incorrectly used in the library you used. I'll create a sample to show you why that code is wrong.

import pandas as pd
data = {'A': [59, 11, 65, 95], 'B': [63, 87, 22, 87], 
        'C': [49, 51, 9, 99], 'D': [4, 39, 77, 65]}
df = pd.DataFrame(data)

df

    A   B   C   D
0  59  63  49   4
1  11  87  51  39
2  65  22   9  77
3  95  87  99  65

Try deleting the 'A' column from df, and you'll get the same error if you omit the axis parameter.

df.drop('A', 1)

error

TypeError: DataFrame.drop() takes from 1 to 2 positional arguments but 3 were given

we can delete column 'A' from df without error if you don't omit the axis parameter.

df.drop('A', axis=1)

It looks like the pywedge library you used is based on an older version of Pandas, which is why it omits the parameter axis in the drop function. I think a proper downgrade of the Pandas version(maybe 1.4.4 based on @ouroboros1's answer) should fix it.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): get the same error
  • User mentioned (1): @ouroboros1's
  • High reputation (-2):
Posted by: Panda Kim