Skip to content

Conversation

drewfustin
Copy link
Contributor

Allows user to pass dtype='category' when creating a Series with Categorical, but produces a ValueError is any non-categorical dtype is passed.

self.assertFalse(is_categorical(1.0))

def test_series_with_dtype(self):
self.assertRaises(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment like #GH 12574, pointing back to the original issue?

@TomAugspurger
Copy link
Contributor

Just the one comment, +1 otherwise (assuming Travis passes). Thanks!

@TomAugspurger TomAugspurger added the Categorical Categorical Data Type label Mar 16, 2016
@TomAugspurger TomAugspurger added this to the 0.18.1 milestone Mar 16, 2016
@TomAugspurger TomAugspurger added the Dtype Conversions Unexpected or buggy dtype conversions label Mar 16, 2016
elif isinstance(data, Categorical):
if dtype is not None:
# Allow dtype=category only, otherwise error
if ((dtype is not None) and
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not right here; use is_categorical_dtype(dtype)

@codecov-io
Copy link

Current coverage is 88.64%

Merging #12636 into master will not affect coverage as of 724c309

@@            master   #12636   diff @@
=======================================
  Files          275      275       
  Stmts       133688   133695     +7
  Branches         0        0       
  Methods          0        0       
=======================================
+ Hit         118511   118520     +9
  Partial          0        0       
+ Missed       15177    15175     -2

Review entire Coverage Diff as of 724c309

Powered by Codecov. Updated on successful CI builds.

@jreback jreback closed this in a5670f2 Mar 16, 2016
@jreback
Copy link
Contributor

jreback commented Mar 16, 2016

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Categorical Categorical Data Type Dtype Conversions Unexpected or buggy dtype conversions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Series with Categorical and dtype

4 participants