Skip to content

fix: remove redundant axis argument from pandas drop() call#264

Merged
mplatzer merged 2 commits intomostly-ai:mainfrom
MrCosta57:fix-tabular-generation
Mar 2, 2026
Merged

fix: remove redundant axis argument from pandas drop() call#264
mplatzer merged 2 commits intomostly-ai:mainfrom
MrCosta57:fix-tabular-generation

Conversation

@MrCosta57
Copy link
Contributor

Summary

This PR fixes a compatibility issue with pandas 3.0 where calling DataFrame.drop() with both the axis parameter and the index or columns parameter raises a ValueError.

Motivation

In pandas versions prior to 3.0, specifying both axis and index or columns in drop() was allowed, although redundant. Starting with pandas 3.0, this usage is no longer permitted and raises the following error:

ValueError: Cannot specify both 'axis' and 'index'/'columns'

This caused failures in the encoding and analysis pipeline when running with newer pandas versions.

Changes Made

  • Removed the redundant axis argument from DataFrame.drop() calls where columns or index is already specified.
  • Updated the implementation to follow the pandas 3.0 API requirements.
  • Ensured behavior remains identical to previous versions.

Before

df.drop(columns=cols, axis=1)

After

df.drop(columns=cols)

Backward Compatibility

This change is fully backward compatible:

  • Works with pandas 3.0 and newer
  • Maintains identical behavior with older pandas versions
  • No API changes for users

Impact

This fix ensures compatibility with pandas 3.0+ and prevents runtime failures during data processing.

@cursor
Copy link

cursor bot commented Feb 27, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 17.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@mplatzer mplatzer merged commit b86a390 into mostly-ai:main Mar 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants