|
25 | 25 | is_timedelta64_dtype,
|
26 | 26 | is_categorical,
|
27 | 27 | is_categorical_dtype,
|
28 |
| - is_integer_dtype, |
29 | 28 | is_list_like, is_sequence,
|
30 | 29 | is_scalar,
|
31 | 30 | is_dict_like)
|
@@ -352,29 +351,8 @@ def __init__(self, values, categories=None, ordered=None, dtype=None,
|
352 | 351 | dtype = CategoricalDtype(categories, ordered)
|
353 | 352 |
|
354 | 353 | else:
|
355 |
| - # there were two ways if categories are present |
356 |
| - # - the old one, where each value is a int pointer to the levels |
357 |
| - # array -> not anymore possible, but code outside of pandas could |
358 |
| - # call us like that, so make some checks |
359 |
| - # - the new one, where each value is also in the categories array |
360 |
| - # (or np.nan) |
361 |
| - |
362 | 354 | codes = _get_codes_for_values(values, dtype.categories)
|
363 | 355 |
|
364 |
| - # TODO: check for old style usage. These warnings should be removes |
365 |
| - # after 0.18/ in 2016 |
366 |
| - if (is_integer_dtype(values) and |
367 |
| - not is_integer_dtype(dtype.categories)): |
368 |
| - warn("Values and categories have different dtypes. Did you " |
369 |
| - "mean to use\n'Categorical.from_codes(codes, " |
370 |
| - "categories)'?", RuntimeWarning, stacklevel=2) |
371 |
| - |
372 |
| - if (len(values) and is_integer_dtype(values) and |
373 |
| - (codes == -1).all()): |
374 |
| - warn("None of the categories were found in values. Did you " |
375 |
| - "mean to use\n'Categorical.from_codes(codes, " |
376 |
| - "categories)'?", RuntimeWarning, stacklevel=2) |
377 |
| - |
378 | 356 | if null_mask.any():
|
379 | 357 | # Reinsert -1 placeholders for previously removed missing values
|
380 | 358 | full_codes = - np.ones(null_mask.shape, dtype=codes.dtype)
|
|
0 commit comments