Skip to content

Conversation

@bashtage
Copy link
Contributor

@bashtage bashtage commented Jan 24, 2017

Prevent locale from affecting Stata file date creation, which must
be en_US.

xref #13856

  • tests added / passed
  • passes git diff upstream/master | flake8 --diff
  • whatsnew entry

@bashtage
Copy link
Contributor Author

Does not close any issue since this was only identified as part of #13856.

Passes all tests (not just slow) when locale is zh_CN.utf8. This config is not enabled by default.

@bashtage bashtage force-pushed the stata-locale-date-fix branch from 5a54fc8 to a23a92f Compare January 24, 2017 14:59
month_lookup = {i + 1: month for i, month in enumerate(months)}
ts = (time_stamp.strftime("%d ") +
month_lookup[time_stamp.month] +
time_stamp.strftime(" %Y %H:%M"))
Copy link
Contributor

@jreback jreback Jan 24, 2017

Choose a reason for hiding this comment

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

you could also

with pandas.util.testing.set_locale('en_US.UTF-8'):
    ....

not sure if this is better though

@jreback jreback added IO Stata read_stata, to_stata Bug labels Jan 24, 2017
@jreback
Copy link
Contributor

jreback commented Jan 24, 2017

https://travis-ci.org/jreback/pandas/jobs/194872508

oddly this didn't fail on py3.

@codecov-io
Copy link

codecov-io commented Jan 24, 2017

Current coverage is 85.99% (diff: 100%)

No coverage report found for master at 9309eba.

Powered by Codecov. Last update 9309eba...a23a92f

@jreback
Copy link
Contributor

jreback commented Jan 24, 2017

can you rebase and push again, just to make sure this passes? ping on green.

@jreback jreback added this to the 0.20.0 milestone Jan 24, 2017
Prevent locale from affecting Stata file date creation, which must
be en_US.

xref pandas-dev#13856
@bashtage bashtage force-pushed the stata-locale-date-fix branch from a23a92f to a55bfd8 Compare January 24, 2017 21:31
@bashtage
Copy link
Contributor Author

@jreback Green - one test fails in another module that has the same problem due to locales.

https://travis-ci.org/pandas-dev/pandas/jobs/194970098

@jreback jreback closed this in 3ad978a Jan 25, 2017
@jreback
Copy link
Contributor

jreback commented Jan 25, 2017

thanks for the fix @bashtage

@bashtage bashtage deleted the stata-locale-date-fix branch February 17, 2017 18:58
AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this pull request Mar 21, 2017
Prevent locale from affecting Stata file date creation, which must  be
en_US.

xref pandas-dev#13856

Author: Kevin Sheppard <kevin.k.sheppard@gmail.com>

Closes pandas-dev#15208 from bashtage/stata-locale-date-fix and squashes the following commits:

a55bfd8 [Kevin Sheppard] BUG: Remove locale conversion from Stata file date
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.

3 participants