Skip to content

Describe doc - #4762

Merged
martindurant merged 10 commits into
dask:masterfrom
martindurant:describe_doc
May 7, 2019
Merged

martindurant merged 10 commits into
dask:masterfrom
martindurant:describe_doc

Conversation

@martindurant

@martindurant martindurant commented Apr 30, 2019 •

Copy link
Copy Markdown
Member
  • Tests added / passed
  • Passes flake8 dask

Written to add extra information to the derived docstring for dataframe.describe ( fixes #4401 )

partially fixes #3265 (simplest solution)

Comment thread dask/dataframe/core.py
@derived_from(pd.DataFrame)
def describe(self, split_every=False, percentiles=None, percentiles_method='default'):
# currently, only numeric describe is supported
"""Currently, only numeric describe is supported """

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We might use this function as a test for the derived_from functionality change in this PR.

As an example, I think that there is already a test in test_utils.py that import dask.dataframe and checks the state of one of the docstrings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good idea

Comment thread dask/utils.py Outdated
]
if extra:
bits.insert(1, extra.rstrip('\n') + '\n\n')
bits.insert(1, indent)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it be possible to move extra below the "this is copied" disclaimer?

Signature: dd.DataFrame.describe(self, split_every=False, percentiles=None, percentiles_method='default')
Docstring:
Generate descriptive statistics that summarize the central tendency,
dispersion and shape of a dataset's distribution, excluding
``NaN`` values.

Currently, only numeric describe is supported

This docstring was copied from pandas.core.frame.DataFrame.describe.

Some inconsistencies with the Dask version may exist.

Analyzes both numeric and object series, as well
as ``DataFrame`` column sets of mixed data types. The output
will vary depending on what is provided. Refer to the notes
below for more detail.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

@martindurant

Copy link
Copy Markdown
Member Author

The errors are py2-only, and I really don't understand them or know if they are caused by this code (seem to be import errors of "methods"). Help!

@mrocklin

mrocklin commented May 4, 2019

Copy link
Copy Markdown
Member

The errors are py2-only, and I really don't understand them or know if they are caused by this code (seem to be import errors of "methods"). Help!

The docstring munging code runs at import time (we have @derived_from decorators in the main file). In your situation I would create a Python 2 environment, try importing the module, and see what happens. Maybe I would also use the Python debugger (if possible at this stage) or maybe put in a pdb statement?

I'm not sure if that helps or not. Hopefully those steps move towards a good solution.

Martin Durant added 2 commits May 6, 2019 12:28
(this is only relavant to -OO optimized bytecode, which strips docstrings)
@martindurant

Copy link
Copy Markdown
Member Author

There we go :) It was to do with docstring stripping during bytecode optimisation.

@martindurant

Copy link
Copy Markdown
Member Author

I think this should be merged now, can press the button if no one objects by tomorrow morning

@martindurant
martindurant merged commit cae23c2 into dask:master May 7, 2019
almaleksia added a commit to almaleksia/dask that referenced this pull request May 10, 2019
jorge-pessoa pushed a commit to jorge-pessoa/dask that referenced this pull request May 14, 2019
* Add disclaimer to dataframe.describe() [skip ci]

Fixes dask#4401

* Simplest revamt of dataframe doc generation

* add tests

* extra docstring after disclaimer

* add a little to the relavant docstring [skip ci]

* py2fixes

* Do not add lines to empty docstring

(this is only relavant to -OO optimized bytecode, which strips docstrings)

* skip on py2
@martindurant
martindurant deleted the describe_doc branch February 9, 2021 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dask dataframe 'describe()' option fails for 'object' dtype Improving docstring wrapping functions

2 participants