-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Categorical.from_codes warns if None
is in categories
#13648
Comments
Because
Appreciated if you're willing to fix warning to be more appropriate. |
@sinhrks can you clarify what you mean by "pandas regards |
I meant both are treated as missing, see here. |
@jreback: Sure does. Will add tests to confirm. |
Deprecated in 0.17.0. xref pandas-devgh-10748 xref pandas-devgh-13648
I think the same question of @ssanderson still stands, as the message still says "Categorial categories cannot be NaN", while he uses None, which makes it a bit confusing. |
@jorisvandenbossche I'll change the wording to |
Deprecated in 0.17.0. xref #10748 xref #13648 Author: Jeff Reback <jeff@reback.net> Author: gfyoung <gfyoung17@gmail.com> Closes #15806 from gfyoung/categories-nan-drop and squashes the following commits: 318175b [Jeff Reback] TST: test pd.NaT with correct dtype 4dce349 [gfyoung] Drop support for NaN categories in Categorical
Deprecated in 0.17.0. xref pandas-dev#10748 xref pandas-dev#13648 Author: Jeff Reback <jeff@reback.net> Author: gfyoung <gfyoung17@gmail.com> Closes pandas-dev#15806 from gfyoung/categories-nan-drop and squashes the following commits: 318175b [Jeff Reback] TST: test pd.NaT with correct dtype 4dce349 [gfyoung] Drop support for NaN categories in Categorical
Born from a gitter conversation with @jorisvandenbossche and @jreback.
As of #10748, it's deprecated to have
np.NaN
as a category label. The deprecation warning also fires ifNone
is a category, but it's unclear whether this is intended behavior, and the error message explicitly refers to NaN, which is confusing.Code Sample, a copy-pastable example if possible
Expected Output
I wouldn't have expected a warning about
NaN
on an array that doesn't containNaN
.output of
pd.show_versions()
commit: None
python: 2.7.10.final.0
python-bits: 64
OS: Linux
OS-release: 4.2.0-16-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 24.0.2
Cython: 0.22.1
numpy: 1.11.1
scipy: 0.15.1
statsmodels: 0.6.1
xarray: None
IPython: 3.2.1
sphinx: 1.3.4
patsy: 0.4.0
dateutil: 2.4.2
pytz: 2016.4
blosc: 1.2.8
bottleneck: 1.0.0
tables: None
numexpr: 2.4.6
matplotlib: 1.4.3
openpyxl: None
xlrd: 0.9.4
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.8
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.7.3
boto: 2.38.0
pandas_datareader: 0.2.1
The text was updated successfully, but these errors were encountered: