-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: melt should preserve Categorical id_vars #15853
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
Comments
xref to #15785 this is the same causation (and lack of complete testing). pull-requests are welcome. |
I want to try my hand at this bug, it looks like when np.tile is called the categorical dtype is lost:
I can check what the type of the col is and if it's categorical I can just cast it back. Do you think that's a valid solution? |
so you have this
and this is whats produced
FYI when you fix this bug it will also fix #15785 however, I think we should actually define
lmk when you need more guidance. This is sort of 'trivial' to fix, but the right way of doing this is as I outlined above. Its a bit more code, but puts things in the correct places. And need tests for this (the new |
Add support for tile and not simply repeat.
Add support for tile and not simply repeat.
it might be much better / fixed as categorical has seen much work recently if fixed just some tests would be great (otherwise fix great too) |
Add support for tile and not simply repeat.
Well, I'll put up a PR for this one and leave #15785 alone for now. |
Also add support for tile and not simply repeat.
Also add support for tile and not simply repeat.
Also add support for tile and not simply repeat.
This looks fixed on master. Could use a test.
|
When using
melt
, I'd expect the type of the columns specified asid_vars
to be preserved.Categorical types seem to be lost in the process:
shows:
Output of
pd.show_versions()
pandas: 0.19.2
nose: 1.3.7
pip: None
setuptools: 33.1.1
Cython: 0.25.2
numpy: 1.12.0
scipy: 0.18.1
statsmodels: 0.8.0.dev0+c906881
xarray: None
IPython: 5.1.0
sphinx: 1.4.9
patsy: 0.4.1+dev
dateutil: 2.5.3
pytz: 2016.7
blosc: None
bottleneck: None
tables: 3.3.0
numexpr: 2.6.1
matplotlib: 2.0.0
openpyxl: 2.3.0
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: 3.7.3
bs4: None
html5lib: None
httplib2: 0.9.2
apiclient: None
sqlalchemy: 1.1.6
pymysql: None
psycopg2: None
jinja2: 2.9.5
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: