Skip to content

ENH: Enable automatic writing of dates to Stata files #13710

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

Conversation

bashtage
Copy link
Contributor

@bashtage bashtage commented Jul 19, 2016

Automatically select type %tc for datetime[ns] columns
Change ValueErrors to NotImplementedError for unsupported types
Add tests for select exceptions

closes #12259

self._convert_dates[key]
)
dtypes[key] = np.dtype(new_type)
dtypes[key] = np.dtype(new_type)
Copy link
Contributor

Choose a reason for hiding this comment

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

this would blow up if they did convert_dates on a datetime64-tz aware type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is_datetime64_dtype is False for tz aware datetimes.

@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions IO Stata read_stata, to_stata labels Jul 19, 2016
@bashtage bashtage force-pushed the correct-stata-date-handling branch from 0b3a253 to 7b5f321 Compare July 19, 2016 22:58
@codecov-io
Copy link

codecov-io commented Jul 19, 2016

Current coverage is 84.53%

No coverage report found for master at 1ce8f8e.

Powered by Codecov. Last updated by 1ce8f8e...73f6565

@bashtage bashtage force-pushed the correct-stata-date-handling branch 2 times, most recently from 991ec0e to 73f6565 Compare July 20, 2016 11:15
@jreback jreback added this to the 0.19.0 milestone Jul 20, 2016
@@ -432,7 +432,8 @@ def parse_dates_safe(dates, delta=False, year=False, days=False):
d = parse_dates_safe(dates, year=True)
conv_dates = d.year
else:
raise ValueError("fmt %s not understood" % fmt)
Copy link
Contributor

Choose a reason for hiding this comment

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

is this where you validate the supported format? (e.g. the tc and such). I think this would be a ValueError if its not in the list (yes unsupported sort of means this, but more likely it was a typo by the user). and datetime w/tz can be not implemented error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Revered this to ValueError since it should only raise if the type doesn't exist.

Automatically select type %tc for datetime[ns] columns
Change ValueErrors to NotImplementedError for unsupported types
Add tests for select exceptions
Improve to_stata and StataWriter docstrings

closes pandas-dev#12259
@bashtage bashtage force-pushed the correct-stata-date-handling branch from 73f6565 to f77e40a Compare July 20, 2016 23:18
@jreback jreback closed this in 0fe5a34 Jul 21, 2016
@jreback
Copy link
Contributor

jreback commented Jul 21, 2016

thanks!

@bashtage bashtage deleted the correct-stata-date-handling branch January 24, 2017 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions IO Stata read_stata, to_stata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValueError: Data type datetime64[ns] not currently understood. Please report an error to the developers.
3 participants