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

More helpful Stata object dtype error. (#23572) #23646

Closed
wants to merge 1 commit into from

Conversation

kylebarron
Copy link
Contributor

This changes the error message shown when trying to write a non-string column with dtype object to Stata. It also includes the name of the offending column in the error message.

@pep8speaks
Copy link

Hello @kylebarron! Thanks for submitting the PR.

@codecov
Copy link

codecov bot commented Nov 12, 2018

Codecov Report

Merging #23646 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #23646   +/-   ##
=======================================
  Coverage   92.24%   92.24%           
=======================================
  Files         161      161           
  Lines       51317    51317           
=======================================
  Hits        47338    47338           
  Misses       3979     3979
Flag Coverage Δ
#multiple 90.63% <ø> (ø) ⬆️
#single 42.31% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d4dd50...b10f728. Read the comment docs.

@@ -466,6 +466,12 @@ def parse_dates_safe(dates, delta=False, year=False, days=False):
"""


general_object_array_error = """
Writing non-string object columns is not supported. Column '%s' does not
Copy link
Contributor

Choose a reason for hiding this comment

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

We've been moving to new-style format strings. Could you change the %s to {}?

Also for relatively simply error message like this, having the message next to where it's raised helps keep the code clearer. Could you define this message where it's used? Use params to wrap lines in the source

msg = (
    "Writing non-string... "
    " ... "
)
raise ValueError(msg)

@jreback
Copy link
Contributor

jreback commented Nov 17, 2018

this PR is moot after #23718 @bashtage ?

@jreback jreback closed this Nov 17, 2018
@bashtage
Copy link
Contributor

Yes. The error I gave has more detail and incorporates more of the consensus about what is helpful (I think)

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.

df.to_stata fails when a column of type object contains only None
5 participants