Skip to content

add data_columns to doc string #13065

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 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,10 @@ def to_hdf(self, path_or_buf, key, **kwargs):
/ selecting subsets of the data
append : boolean, default False
For Table formats, append the input data to the existing
data_columns : list of columns, or True, default None
This will create additional indexed columns for on-disk queries,
by default only 'index' and 'columns' are indexed. True will index
all columns.
Copy link
Contributor

Choose a reason for hiding this comment

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

this is only true for a data frame (and not true for other objects); by default the axes are indexes. e.g. index and columns might be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm sorry, it's not clear what exactly you want changed how.

Copy link
Contributor

Choose a reason for hiding this comment

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

this is a generic doc-string that applies when you are looknig at Series,DataFrame, or Panel. so it should either be somewhat generic or specific to that type (which is harder and not worth it). You are saying 'index' and 'columns', which don't apply to Series/Panel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How can we make this specific to Series,DataFrame and Panel? Because considering the complexity of pandas I find it highly important to have the docstrings as useful as possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think in this case it might not be easy to do this because someone is doing:

``HDFStore.append, there isn't any object at that point, so you can just give an example e.g. Series -> 'index' is defined, DataFrame -> 'index' and 'columns' ,Panel -> 'items', 'major_axis','minor_axis'` (put them in bullet points).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, for a Panel I actually can not add columns to the index?
If that's true, how about then I add the docstring like so:

data_columns : only applicable to DataFrames, see examples

and then I add the usage examples with the suggestions you made above?

complevel : int, 1-9, default 0
If a complib is specified compression will be applied
where possible
Expand Down
6 changes: 4 additions & 2 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,10 @@ def append(self, key, value, format=None, append=True, columns=None,
/ selecting subsets of the data
append : boolean, default True, append the input data to the
existing
data_columns : list of columns to create as data columns, or True to
use all columns
data_columns : list of columns, or True, default None
This will create additional indexed columns for on-disk queries,
by default only 'index' and 'columns' are indexed. True will index
all columns.
min_itemsize : dict of columns that specify minimum string sizes
nan_rep : string to use as string nan represenation
chunksize : size to chunk the writing
Expand Down