Skip to content

DOC: Updated doc-string using new doc-string design for DataFrameFormatter #11057

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 1 commit into from
Sep 13, 2015
Merged

DOC: Updated doc-string using new doc-string design for DataFrameFormatter #11057

merged 1 commit into from
Sep 13, 2015

Conversation

terrytangyuan
Copy link
Contributor

DataFrameFormatter does not have this parameter: force_unicode_docstring. This change uses the doc-string re-design in #11011

@jreback jreback added the Docs label Sep 11, 2015
@jreback
Copy link
Contributor

jreback commented Sep 11, 2015

what is this supposed to address?

@terrytangyuan
Copy link
Contributor Author

Redundant parameter in docstring

@terrytangyuan
Copy link
Contributor Author

So the original docstring for DataFrameFormatter is not correct(one or two more parameters in docstring but not in the function declaration). This PR fixed that. Can you merge?

@jreback
Copy link
Contributor

jreback commented Sep 12, 2015

post the original and the new

@terrytangyuan
Copy link
Contributor Author

common_docstring = """
    Parameters
    ----------
    buf : StringIO-like, optional
        buffer to write to
    columns : sequence, optional
        the subset of columns to write; default None writes all columns
    col_space : int, optional
        the minimum width of each column
    header : bool, optional
        whether to print column labels, default True
    index : bool, optional
        whether to print index (row) labels, default True
    na_rep : string, optional
        string representation of NAN to use, default 'NaN'
    formatters : list or dict of one-parameter functions, optional
        formatter functions to apply to columns' elements by position or name,
        default None. The result of each function must be a unicode string.
        List must be of length equal to the number of columns.
    float_format : one-parameter function, optional
        formatter function to apply to columns' elements if they are floats,
        default None. The result of this function must be a unicode string.
    sparsify : bool, optional
        Set to False for a DataFrame with a hierarchical index to print every
        multiindex key at each row, default True
    index_names : bool, optional
        Prints the names of the indexes, default True"""

justify_docstring  = """
    justify : {'left', 'right'}, default None
        Left or right-justify the column labels. If None uses the option from
        the print configuration (controlled by set_option), 'right' out
        of the box."""

force_unicode_docstring = """
    force_unicode : bool, default False
        Always return a unicode result. Deprecated in v0.10.0 as string
        formatting is now rendered to unicode by default."""

return_docstring = """

    Returns
    -------
    formatted : string (or unicode, depending on data and options)"""

The original is the sum of all the above

docstring_to_string = common_docstring + justify_docstring + force_unicode_docstring + return_docstring

The new one is

common_docstring + justify_docstring + return_docstring

or the original one excluding force_unicode_docstring

@terrytangyuan
Copy link
Contributor Author

i am excluding it since this function/class does not have force_unicode_docstring to be passed in

@jreback
Copy link
Contributor

jreback commented Sep 12, 2015

I can read the code
I want to see what it looks like under 0.16.2 thrn after this change is applied

@terrytangyuan
Copy link
Contributor Author

I am not sure what you mean but just to better clarify this: This PR only excludes/removes one parameter from the docstring of DataFrameFormatter since DataFrameFormatter does not have force_unicode_docstring as a parameter.

@jreback
Copy link
Contributor

jreback commented Sep 12, 2015

post what the doc string looks like before and after the change

@terrytangyuan
Copy link
Contributor Author

The original:

    Parameters
    ----------
    buf : StringIO-like, optional
        buffer to write to
    columns : sequence, optional
        the subset of columns to write; default None writes all columns
    col_space : int, optional
        the minimum width of each column
    header : bool, optional
        whether to print column labels, default True
    index : bool, optional
        whether to print index (row) labels, default True
    na_rep : string, optional
        string representation of NAN to use, default 'NaN'
    formatters : list or dict of one-parameter functions, optional
        formatter functions to apply to columns' elements by position or name,
        default None. The result of each function must be a unicode string.
        List must be of length equal to the number of columns.
    float_format : one-parameter function, optional
        formatter function to apply to columns' elements if they are floats,
        default None. The result of this function must be a unicode string.
    sparsify : bool, optional
        Set to False for a DataFrame with a hierarchical index to print every
        multiindex key at each row, default True
    index_names : bool, optional
        Prints the names of the indexes, default True
    justify : {'left', 'right'}, default None
        Left or right-justify the column labels. If None uses the option from
        the print configuration (controlled by set_option), 'right' out
        of the box.
    force_unicode : bool, default False
        Always return a unicode result. Deprecated in v0.10.0 as string
        formatting is now rendered to unicode by default.

    Returns
    -------
    formatted : string (or unicode, depending on data and options)

The new one:

    Parameters
    ----------
    buf : StringIO-like, optional
        buffer to write to
    columns : sequence, optional
        the subset of columns to write; default None writes all columns
    col_space : int, optional
        the minimum width of each column
    header : bool, optional
        whether to print column labels, default True
    index : bool, optional
        whether to print index (row) labels, default True
    na_rep : string, optional
        string representation of NAN to use, default 'NaN'
    formatters : list or dict of one-parameter functions, optional
        formatter functions to apply to columns' elements by position or name,
        default None. The result of each function must be a unicode string.
        List must be of length equal to the number of columns.
    float_format : one-parameter function, optional
        formatter function to apply to columns' elements if they are floats,
        default None. The result of this function must be a unicode string.
    sparsify : bool, optional
        Set to False for a DataFrame with a hierarchical index to print every
        multiindex key at each row, default True
    index_names : bool, optional
        Prints the names of the indexes, default True
    justify : {'left', 'right'}, default None
        Left or right-justify the column labels. If None uses the option from
        the print configuration (controlled by set_option), 'right' out
        of the box.

    Returns
    -------
    formatted : string (or unicode, depending on data and options)

@jreback
Copy link
Contributor

jreback commented Sep 12, 2015

hmm, I think we can take that force_unicode out entirely, it was removed in 0.14.0

@terrytangyuan
Copy link
Contributor Author

Okay I'll take it out.

@terrytangyuan
Copy link
Contributor Author

No wonder i don't see any usage of force_unicode when PR #11011 for to_html, to_latex, etc. I'll make the changes on those doc-strings too.

@jreback
Copy link
Contributor

jreback commented Sep 12, 2015

perfect ping when green

… outdated doc-string (+1 squashed commit)

Squashed commits:
[068b1fd] DOC: Modified incorrect doc-string for DataFrameFormatter using new doc-string design  (+1 squashed commit)
Squashed commits:
[12e032d] DOC: Updated doc-string using new doc-string design for DataFrameFormatter

`DataFrameFormatter` does not have this parameter: `force_unicode_docstring`.
@terrytangyuan
Copy link
Contributor Author

@jreback On green now. Thanks.

jreback added a commit that referenced this pull request Sep 13, 2015
DOC: Updated doc-string using new doc-string design for DataFrameFormatter
@jreback jreback merged commit 840f88e into pandas-dev:master Sep 13, 2015
@jreback
Copy link
Contributor

jreback commented Sep 13, 2015

thanks!

@jreback jreback added this to the 0.17.0 milestone Sep 13, 2015
@terrytangyuan terrytangyuan deleted the patch-1 branch September 13, 2015 20:27
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.

2 participants