-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update the DataFrame.to_hdf() docstirng #20186
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
Conversation
Hello @acidburnburn! Thanks for updating the PR.
Comment last updated on March 22, 2018 at 09:13 Hours UTC |
pandas/core/generic.py
Outdated
-------- | ||
DataFrame.to_csv : write out to a csv file. | ||
DataFrame.to_sql : write to a sql table. | ||
DataFrame.to_feather : write out feather-format for DataFrames. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add DataFrame.to_parquet, read_hdf
pandas/core/generic.py
Outdated
3 4 | ||
dtype: int64 | ||
|
||
Notes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Notes are before examples.
If you want to put a link, link to the section in the io.rst docs. You can add the HDF5 link in there if you want (in an appropriate location)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually they already have link to the same manual there, so just removed this section.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also don't know why, but previously not all changes were pushed here, some remained locally, fixed it. Sorry for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Added some more comments
pandas/core/generic.py
Outdated
|
||
In order to add another :class:`~pandas.DataFrame` or | ||
:class:`~pandas.Series` to an existing HDF file please use append mode | ||
and different a key. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add here a link to the user guide (because there is a lot more information there). You can use something like For more information see the :ref:`user guide <io.hdf5>`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint! This one is hard for me, because i'm not an expert in rst :( I put the line as you suggested, with the right subsection of that manual. when i generate html with 'make.py html' it doesnt' have a link. Is it ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is fine (when only building the docstring, the full user guide is not built, and therefore the link does not seem to work)
pandas/core/generic.py
Outdated
Identifier for the group in the store. | ||
mode : {'a', 'w', 'r+'}, default is 'a' | ||
Mode to open file: | ||
- ``'w'``: write, a new file is created (an existing file with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good to make this a list, but for sphinx , no indentation is needed (compared to "Mode .." on the line above), but, it needs a blank line between both lines (rst syntax details ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pandas/core/generic.py
Outdated
- `'r+'`: similar to ``'a'``, but the file must already exist. | ||
format : {'fixed', 'table'}, default is 'fixed' | ||
Possible values: | ||
- fixed: Fixed format. Fast writing/reading. Not-appendable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here about indentation / blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, can you add single quotes around fixed (like 'fixed'
), to make it clear it is a string
(and same for table below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pandas/core/generic.py
Outdated
- ``'a'``: append, an existing file is opened for reading and | ||
writing, and if the file does not exist it is created. | ||
- `'r+'`: similar to ``'a'``, but the file must already exist. | ||
format : {'fixed', 'table'}, default is 'fixed' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"default is 'fixed' " -> "default 'fixed' "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pandas/core/generic.py
Outdated
- fixed: Fixed format. Fast writing/reading. Not-appendable, | ||
nor searchable. | ||
- table: Table format. Write as a PyTables Table structure | ||
which may perform worse but allow more flexible operations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another identation issue. Here, the "which ..." needs to align with "table: .." on the line above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pandas/core/generic.py
Outdated
2 3 | ||
3 4 | ||
dtype: int64 | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add in the end here a code block with
>>> import os
>>> os.remove('data.h5')
(so running the doctests does not leave behind files)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Many thanks for you comments, they are really useful.
pandas/core/generic.py
Outdated
... index=['a', 'b', 'c']) | ||
>>> df.to_hdf('data.h5', key='df', mode='w') | ||
|
||
We can append another object to the same file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use "add" here instead of "append", because "append" is also a keyword with a different behaviour (appending rows to the same table, not the same file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Codecov Report
@@ Coverage Diff @@
## master #20186 +/- ##
==========================================
- Coverage 91.77% 91.77% -0.01%
==========================================
Files 152 152
Lines 49205 49215 +10
==========================================
+ Hits 45159 45167 +8
- Misses 4046 4048 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates!
Thanks @acidburnburn ! |
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>
Please include the output of the validation script below between the "```" ticks:
If the validation script still gives errors, but you think there is a good reason
to deviate in this case (and there are certainly such cases), please state this
explicitly.
Checklist for other PRs (remove this part if you are doing a PR for the pandas documentation sprint):
git diff upstream/master -u -- "*.py" | flake8 --diff