Skip to content

BUG: Using categorical dtype in read_json #25573

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

Closed
wants to merge 2 commits into from
Closed

BUG: Using categorical dtype in read_json #25573

wants to merge 2 commits into from

Conversation

anki-code
Copy link

@anki-code anki-code commented Mar 6, 2019

Pandas read_json ignores category dtype. This fix is need to using category in read_json.
Example: pd.read_json(filename, lines=True, dtype={'ColumnName':'category'}).

fyi #21892

This fix need to using `category` in `read_json`. Example: `pd.read_json(filename, lines=True, dtype={'ColumnName':'category'})`
@pep8speaks
Copy link

pep8speaks commented Mar 6, 2019

Hello @anki-code! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-03-06 18:11:31 UTC

@WillAyd
Copy link
Member

WillAyd commented Mar 6, 2019

This needs tests - should always be the first part of any PR

@WillAyd WillAyd added IO JSON read_json, to_json, json_normalize Categorical Categorical Data Type labels Mar 6, 2019
@codecov
Copy link

codecov bot commented Mar 6, 2019

Codecov Report

Merging #25573 into master will decrease coverage by 49.54%.
The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #25573       +/-   ##
===========================================
- Coverage   91.26%   41.71%   -49.55%     
===========================================
  Files         173      173               
  Lines       52966    52968        +2     
===========================================
- Hits        48337    22096    -26241     
- Misses       4629    30872    +26243
Flag Coverage Δ
#multiple ?
#single 41.71% <33.33%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/io/json/json.py 62.79% <33.33%> (-30.44%) ⬇️
pandas/io/formats/latex.py 0% <0%> (-100%) ⬇️
pandas/core/categorical.py 0% <0%> (-100%) ⬇️
pandas/io/sas/sas_constants.py 0% <0%> (-100%) ⬇️
pandas/tseries/plotting.py 0% <0%> (-100%) ⬇️
pandas/tseries/converter.py 0% <0%> (-100%) ⬇️
pandas/io/formats/html.py 0% <0%> (-99.36%) ⬇️
pandas/core/groupby/categorical.py 0% <0%> (-95.46%) ⬇️
pandas/io/sas/sas7bdat.py 0% <0%> (-91.17%) ⬇️
pandas/io/sas/sas_xport.py 0% <0%> (-90.15%) ⬇️
... and 131 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e652ac...e3bb759. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 6, 2019

Codecov Report

Merging #25573 into master will decrease coverage by <.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25573      +/-   ##
==========================================
- Coverage   91.26%   91.25%   -0.01%     
==========================================
  Files         173      173              
  Lines       52966    52968       +2     
==========================================
+ Hits        48337    48338       +1     
- Misses       4629     4630       +1
Flag Coverage Δ
#multiple 89.83% <66.66%> (-0.01%) ⬇️
#single 41.71% <33.33%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/io/json/json.py 93.02% <66.66%> (-0.21%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e652ac...e3bb759. Read the comment docs.

@anki-code anki-code changed the title Using categorical dtype in read_json BUG: Using categorical dtype in read_json Mar 7, 2019
@anki-code anki-code closed this Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type IO JSON read_json, to_json, json_normalize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants