Skip to content

updated empty in pandas.DataFrame.empty or pandas.Series.empty docstrings #42709

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

updated empty in pandas.DataFrame.empty or pandas.Series.empty docstrings #42709

wants to merge 2 commits into from

Conversation

kadatatlukishore
Copy link
Contributor

@kadatatlukishore
Copy link
Contributor Author

Whenever I am trying to run this command python make.py --single pandas.Series.empty

I am getting this error. Please help me @MarcoGorelli

File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\__init__.py", line 22, in <module>
    from pandas.compat import is_numpy_dev as _is_numpy_dev
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\compat\__init__.py", line 15, in <module>
    from pandas.compat.numpy import (
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\compat\numpy\__init__.py", line 7, in <module>
    from pandas.util.version import Version
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\util\__init__.py", line 1, in <module>
    from pandas.util._decorators import (  # noqa
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\util\_decorators.py", line 14, in <module>
    from pandas._libs.properties import cache_readonly  # noqa
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\_libs\__init__.py", line 12, in <module>
    from pandas._libs.interval import Interval
ModuleNotFoundError: No module named 'pandas._libs.interval'

@MarcoGorelli
Copy link
Member

you'll need to rebuild the c extensions - see https://pandas.pydata.org/pandas-docs/stable/development/contributing_environment.html#id4

python -m pip install -e . --no-build-isolation --no-use-pep517

@kadatatlukishore
Copy link
Contributor Author

I apologize, I am asking too much.
Thank you so much for helping me out @MarcoGorelli , I used all the steps exactly and still unable to generate the docs

In the doc folder I used the command python make.py html

Traceback (most recent call last):
  File "C:\Users\vskis\PycharmProjects\pandas-doc\doc\make.py", line 377, in <module>
    sys.exit(main())
  File "C:\Users\vskis\PycharmProjects\pandas-doc\doc\make.py", line 373, in main
    return getattr(builder, args.command)()
  File "C:\Users\vskis\PycharmProjects\pandas-doc\doc\make.py", line 231, in html
    ret_code = self._sphinx_build("html")
  File "C:\Users\vskis\PycharmProjects\pandas-doc\doc\make.py", line 148, in _sphinx_build
    return subprocess.call(cmd)
  File "C:\Users\vskis\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 349, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Users\vskis\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\vskis\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1416, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

@MarcoGorelli
Copy link
Member

I don't know, I've not seen that before - @datapythonista do you know?

@datapythonista
Copy link
Member

No idea what the problem can be. I'd start again with a clean environment and repo, and see if that fixes the problem. No other ideas, Sphinx is extremly difficult to debug, I wouldn't try.

@kadatatlukishore
Copy link
Contributor Author

I've tried shell=True in 148 line of make.py and it worked.

return subprocess.call(cmd)

@kadatatlukishore kadatatlukishore changed the title updated empty() docstrings updated empty in pandas.DataFrame.empty or pandas.Series.empty docstrings Jul 26, 2021
@kadatatlukishore
Copy link
Contributor Author

I am unable to add @doc() to the property so added examples.

I will also raise an issue for this.

>>> df_empty = pd.Series({'A' : []})
>>> df_empty.empty
False

@MarcoGorelli
Copy link
Member

I am unable to add @doc() to the property

I think what you'd done in the previous commit was on the right track - could you try that again, then try building the docs just for this method (something like python make.py --single pandas.DataFrame.empty, check the contributing guide), and post what you get?

@kadatatlukishore
Copy link
Contributor Author

kadatatlukishore commented Jul 26, 2021

I am unable to add @doc() to the property

I think what you'd done in the previous commit was on the right track - could you try that again, then try building the docs just for this method (something like python make.py --single pandas.DataFrame.empty, check the contributing guide), and post what you get?

Sure will try that too @MarcoGorelli Thanks ! But facing errors for this line

        @property
   ---> @doc(**_shared_doc_kwargs)
        def empty(self) -> bool_t:

@MarcoGorelli
Copy link
Member

can you show the errors please?

@kadatatlukishore
Copy link
Contributor Author

can you show the errors please?

Traceback (most recent call last):
  File "C:\Users\vskis\PycharmProjects\pandas-doc\doc\make.py", line 377, in <module>
    sys.exit(main())
  File "C:\Users\vskis\PycharmProjects\pandas-doc\doc\make.py", line 359, in main
    globals()["pandas"] = importlib.import_module("pandas")
  File "C:\Users\vskis\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\__init__.py", line 47, in <module>
    from pandas.core.api import (
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\core\api.py", line 48, in <module>
    from pandas.core.groupby import (
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\core\groupby\__init__.py", line 1, in <module>
    from pandas.core.groupby.generic import (
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\core\groupby\generic.py", line 72, in <module>
    from pandas.core.frame import DataFrame
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\core\frame.py", line 132, in <module>
    from pandas.core import (
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\core\generic.py", line 190, in <module>
    class NDFrame(PandasObject, indexing.IndexingMixin):
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\core\generic.py", line 1936, in NDFrame
    def empty(self: FrameOrSeries) -> bool_t:
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\util\_decorators.py", line 388, in decorator
    [
  File "C:\Users\vskis\PycharmProjects\pandas-doc\pandas\util\_decorators.py", line 389, in <listcomp>
    component.format(**params)
KeyError: 'kclass'

@kadatatlukishore
Copy link
Contributor Author

kadatatlukishore commented Jul 26, 2021

Hello @MarcoGorelli , I performed overloading and it worked for documentation. Do you think the code works when we call Series.empty ?

    @property
    def empty(self) -> bool:
         """ FULL DOCSTRING HERE"""
         return NDFrame.empty

@MarcoGorelli
Copy link
Member

Try building the docstring for other functions which use @doc, see if they work - if so, then try to figure out what's different

@kadatatlukishore
Copy link
Contributor Author

Try building the docstring for other functions which use @doc, see if they work - if so, then try to figure out what's different

Working on it, thanks @MarcoGorelli

@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Aug 27, 2021
@MarcoGorelli
Copy link
Member

closing as stale for now, let me know if you want to keep working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants