Skip to content

AttributeError: module 'pandas.compat' has no attribute 'string_types' #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
badiku opened this issue Nov 4, 2020 · 2 comments · Fixed by #374
Closed

AttributeError: module 'pandas.compat' has no attribute 'string_types' #373

badiku opened this issue Nov 4, 2020 · 2 comments · Fixed by #374

Comments

@badiku
Copy link
Contributor

badiku commented Nov 4, 2020

today I got this error:
AttributeError: module 'pandas.compat' has no attribute 'string_types'

and the code is here:

if (isinstance(c, pd.compat.string_types) and pd.compat.isidentifier(c)))

the problem is , there's no pd.compat.string_types now.

pandas removed it at Mar 29, 2019, see here:
pandas-dev/pandas#25903

@martindurant
Copy link
Member

Missed this depr, thanks for posting.
Should be changed to

if (isinstance(c, str) and c.isidentifier()))

Would you care to submit this fix as a PR?

@martindurant
Copy link
Member

(also a test which uses dir() on a dataframe would be useful, as this should have been caught before)

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 a pull request may close this issue.

2 participants