We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In [2]: pd.Series([0,0,0], dtype="category") Out[2]: 0 0 1 0 2 0 dtype: category Categories (1, int64): [0] In [3]: pd.Series(0, index=range(3), dtype="category") --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-3-2c1d7a241071> in <module>() ----> 1 pd.Series(0, index=range(3), dtype="category") /home/nobackup/repo/pandas/pandas/core/series.pyc in __init__(self, data, index, dtype, name, copy, fastpath) 224 else: 225 data = _sanitize_array(data, index, dtype, copy, --> 226 raise_cast_failure=True) 227 228 data = SingleBlockManager(data, index, fastpath=True) /home/nobackup/repo/pandas/pandas/core/series.pyc in _sanitize_array(data, index, dtype, copy, raise_cast_failure) 2961 if len(subarr) != len(index) and len(subarr) == 1: 2962 subarr = create_from_value(subarr[0], index, -> 2963 subarr.dtype) 2964 2965 elif subarr.ndim > 1: /home/nobackup/repo/pandas/pandas/core/series.pyc in create_from_value(value, index, dtype) 2929 else: 2930 if not isinstance(dtype, (np.dtype, type(np.dtype))): -> 2931 dtype = dtype.dtype 2932 subarr = np.empty(len(index), dtype=dtype) 2933 subarr.fill(value) AttributeError: 'CategoricalDtype' object has no attribute 'dtype'
(Not a particularly brilliant use of categories, but they can then be concatenated with others.)
The text was updated successfully, but these errors were encountered:
yeah looks buggy.
Sorry, something went wrong.
obviously the expected result
In [2]: pd.Series(0, index=range(3)).astype("category") Out[2]: 0 0 1 0 2 0 dtype: category Categories (1, int64): [0]
672fb14
Successfully merging a pull request may close this issue.
(Not a particularly brilliant use of categories, but they can then be concatenated with others.)
The text was updated successfully, but these errors were encountered: