Skip to content
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

BUG: No error raised in to_stata() for -np.inf #45350 #45360

Merged
merged 3 commits into from
Jan 16, 2022

Conversation

flcong
Copy link
Contributor

@flcong flcong commented Jan 14, 2022

  • Add an absolute function when checking infinity, which includes both np.inf and -np.inf. Also changed the error message a bit.
  • Add similar tests but replacing np.inf with -np.inf and change the correct error message accordingly

* Add an absolute function when checking infinity, which includes both np.inf and -np.inf. Also changed the error message a bit.
* Add similar tests but replacing np.inf with -np.inf and change the correct error message accordingly
pandas/io/stata.py Outdated Show resolved Hide resolved
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will also need a note in whatsnew/v1.5.0.rst under IO

* Change the fix to make it faster.
* Group the two test for DataFrame containing np.inf or -np.inf into a separate test function.
* Update doc/source/whatsnew/v1.5.0.rst
pandas/io/stata.py Outdated Show resolved Hide resolved
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment otherwise LGTM

@mroeschke mroeschke added this to the 1.5 milestone Jan 14, 2022
* Minor change in code style.
@mroeschke mroeschke added Bug IO Stata read_stata, to_stata labels Jan 14, 2022
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jreback jreback merged commit e84b9ee into pandas-dev:main Jan 16, 2022
@jreback
Copy link
Contributor

jreback commented Jan 16, 2022

thanks @flcong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO Stata read_stata, to_stata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: No error raised when write dta files using to_stata() if the column contains -np.inf
3 participants