Sunday, 9 January 2022

How to update pandas DataFrame.drop() for Future Warning - all arguments of DataFrame.drop except for the argument 'labels' will be keyword-only

df = df.drop('market', 1).rename(columns={'abb':'t1_abb'}) generates the warning FutureWarning: In a future version of pandas all arguments of DataFrame.drop except for the argument 'labels' will be keyword-only.

market is the column we want to drop, and we pass the 1 as a second parameter for axis (0 for index, 1 for columns, so we pass 1).

How can we change this line of code now so that it is not a problem in the future version of pandas / to resolve the warning message now?



from How to update pandas DataFrame.drop() for Future Warning - all arguments of DataFrame.drop except for the argument 'labels' will be keyword-only

No comments:

Post a Comment