Skip to content

Move json_normalize to pd namespace #27615

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

Merged
merged 24 commits into from
Dec 18, 2019
Merged

Move json_normalize to pd namespace #27615

merged 24 commits into from
Dec 18, 2019

Conversation

vishwakftw
Copy link
Contributor

cc: @WillAyd

- Added a whatsnew entry
- Imported pandas.io.json.json_normalize in __init__.py
@WillAyd
Copy link
Member

WillAyd commented Jul 26, 2019

Makes sense for the move. @TomAugspurger do you know how we've messaged things like this to users in the past to not import from pandas.io.json anymore?

@TomAugspurger
Copy link
Contributor

I don't recall on messaging. Probably something "Accessing json_normalize from pandas.io has been deprecated and will be removed in a future version. Uses pandas.json_normalize instead."

But we'll need to make a pandas.io._json_normalize that has the implementation, and pandas.io.json_normalize will warn then call that. pandas/__init__.py will import io._json_normalize as json_normalize.

@vishwakftw
Copy link
Contributor Author

Thanks for review @jreback, please allow me to get back on this by the end of the weekend if that’s ok. I’ll also incorporate @TomAugspurger’s comment on deprecation as well.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jul 26, 2019 via email

- json_normalize --> _json_normalize
- json_normalize inside io.json._normalize is a deprecated method
- update whatsnew docs
- update io docs
- fix broken test_api
@pep8speaks
Copy link

pep8speaks commented Jul 28, 2019

Hello @vishwakftw! 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-12-18 19:02:46 UTC

@TomAugspurger
Copy link
Contributor

Looks like the docs need to be updated: https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=15186

The line numbers may be a bit off, but hopefully close enough.

- Update whatsnew entry
- Update whatsnew entry
@TomAugspurger
Copy link
Contributor

Can you update doc/source/reference/io.rst so that the reference docs for json_normalize are for the top-level?

It seems that build_table_scheme also is exposed. Would you be willing to do a similar change for it? Either here or as a followup.

@vishwakftw
Copy link
Contributor Author

Can you update doc/source/reference/io.rst so that the reference docs for json_normalize are for the top-level?

Yes, will do that.

It seems that build_table_scheme also is exposed. Would you be willing to do a similar change for it? Either here or as a followup.

Would you like me to expose build_table_schema in the pd namespace?

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jul 29, 2019 via email

- Update entry in reference/io.rst
@jorisvandenbossche
Copy link
Member

I also just commented on the issue about build_table_schema (#27586), but I am not sure that that warrants a top-level function.

@WillAyd
Copy link
Member

WillAyd commented Jul 31, 2019

build_table_schema doesn't deserve a top level function as it's not generally useful for end users (it's one part of actually writing out in the table format)

It's unfortunate that json_normalize leaked publicly the way it is now but it certainly has usage and enhancement requests coming in for it, hence this PR

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jul 31, 2019 via email

@WillAyd
Copy link
Member

WillAyd commented Jul 31, 2019 via email

@WillAyd
Copy link
Member

WillAyd commented Aug 23, 2019

@vishwakftw can you check doc failure and merge master?

@vishwakftw
Copy link
Contributor Author

@WillAyd I can't seem to understand where the doc is failing. Could you help?

@WillAyd
Copy link
Member

WillAyd commented Aug 26, 2019

Hmm I guess the old build logs got cleared. Just restarted it so error should show again in say 20 minutes

@vishwakftw
Copy link
Contributor Author

@WillAyd I was unsure about how to deprecate on import, and was wondering if you had an idea (#27615).

@WillAyd
Copy link
Member

WillAyd commented Nov 7, 2019

not sure; this might be OK as is if you can get CI to pass will take another look

@vishwakftw
Copy link
Contributor Author

I'm not sure if the CI failures are relevant.

@WillAyd
Copy link
Member

WillAyd commented Nov 9, 2019

Looks like you need to run black on the changes to pass CI

I’ll take a look at the rest this weekend

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Over to @jreback

@WillAyd
Copy link
Member

WillAyd commented Dec 17, 2019

@vishwakftw can you fix conflicts and ping on green

@vishwakftw
Copy link
Contributor Author

@WillAyd Sure, I've rebased and will ping you once green.

@vishwakftw
Copy link
Contributor Author

@WillAyd There is one failure, I'm not sure if it is related:

=================================== FAILURES ===================================

______________________________ test_scikit_learn _______________________________

[gw1] linux -- Python 3.6.9 /home/travis/miniconda3/envs/pandas-dev/bin/python

df =    A

0  1

1  2

2  3

    @pytest.mark.filterwarnings("ignore:can't:ImportWarning")

    def test_scikit_learn(df):

    

>       sklearn = import_module("sklearn")  # noqa

pandas/tests/test_downstream.py:72: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pandas/tests/test_downstream.py:20: in import_module

    return importlib.import_module(name)

../../../miniconda3/envs/pandas-dev/lib/python3.6/importlib/__init__.py:126: in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

<frozen importlib._bootstrap>:994: in _gcd_import

    ???

<frozen importlib._bootstrap>:971: in _find_and_load

    ???

<frozen importlib._bootstrap>:955: in _find_and_load_unlocked

    ???

<frozen importlib._bootstrap>:665: in _load_unlocked

    ???

<frozen importlib._bootstrap_external>:678: in exec_module

    ???

<frozen importlib._bootstrap>:219: in _call_with_frames_removed

    ???

../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/sklearn/__init__.py:75: in <module>

    from .utils._show_versions import show_versions

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    """

    # License: BSD 3 clause

    

    import platform

    import sys

    import importlib

    

>   from ._openmp_helpers import _openmp_parallelism_enabled

E   ImportError: dlopen: cannot load any more object with static TLS

../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/sklearn/utils/_show_versions.py:12: ImportError

@WillAyd
Copy link
Member

WillAyd commented Dec 18, 2019

Should have been resolved with changes to CI yesterday. Looks like another merge conflict - if you clean up and repush should be green now I think

@vishwakftw
Copy link
Contributor Author

@WillAyd the CI is green now

@WillAyd WillAyd merged commit 5c8bd04 into pandas-dev:master Dec 18, 2019
@WillAyd
Copy link
Member

WillAyd commented Dec 18, 2019

Great job with this @vishwakftw !

@vishwakftw
Copy link
Contributor Author

Thank you @WillAyd. Apologies for the delay in getting this merged.

@vishwakftw vishwakftw deleted the json_normalize-to-pd branch December 18, 2019 19:54
@vishwakftw vishwakftw restored the json_normalize-to-pd branch December 18, 2019 19:54
@vishwakftw vishwakftw deleted the json_normalize-to-pd branch December 18, 2019 19:54
@vishwakftw vishwakftw restored the json_normalize-to-pd branch December 18, 2019 19:55
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
AlexKirko pushed a commit to AlexKirko/pandas that referenced this pull request Dec 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Deprecate Functionality to remove in pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move json_normalize to pd namespace
6 participants