-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Track times #32700
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
Track times #32700
Conversation
https://www.pytables.org/usersguide/libref/file_class.html?highlight=create_table#tables.File.create_table this option already defaults to |
Yes, you are right. The default value is The possibility to set of track_times can be seen in test on line 325. And on lines 340 and 343 you can see the different or the same check-sums after appropriate setup of track_times. |
18654d9
to
88eea0e
Compare
pandas/io/pytables.py
Outdated
from tables import __version__ as tables_version | ||
from packaging.version import Version | ||
|
||
if Version(tables_version) >= Version("3.4.3"): |
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.
use LooseVersion
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.
changed. Thanks for hint. But, what is the reason for using LooseVersion? I found that packaging.version
is more "modern" - https://stackoverflow.com/a/11887885/1386342
pandas/io/pytables.py
Outdated
@@ -4140,6 +4145,17 @@ def write( | |||
# set the table attributes | |||
table.set_attrs() | |||
|
|||
if track_times is not None: | |||
from tables import __version__ as tables_version | |||
from packaging.version import Version |
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.
this import can be at the top (but use LooseVersion)
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.
Moved. LooseVersion used.
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 had to revert
from tables import __version__ as tables_version
back here because of:
Checks on imported code1s
##[error]Process completed with exit code 2.
Run source activate pandas-dev
Check import. No warnings, and blacklist some optional dependencies
err: pandas should not import: tables, numexpr
Check import. No warnings, and blacklist some optional dependencies DONE
##[error]Process completed with exit code 2.
pandas/io/pytables.py
Outdated
|
||
if Version(tables_version) >= Version("3.4.3"): | ||
options["track_times"] = track_times | ||
else: |
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 just ignore it
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. Ignored. It is now much easier.
# GH 32682 | ||
# enables to set track_times (see `pytables` `create_table` documentation) | ||
|
||
import hashlib |
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.
all imports should be at the top; if you need to skip for a version you can do it with a @td.skip_if_no
. add a test for >= 3.4.3 and one fore before 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.
done 👍
Hi @jreback . I did changes you requested. But, I found another possibility - not to pass track_times in parameters but put it here: https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html . What do you think? |
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.
we already require 3.4.2, so ok to simply bump the minimum to 3.4.3 is fine.
i think accepting it like in this pr is ok. |
36f1c07
to
f134442
Compare
I updated requirements in separate PR and updated this PR accordingly. |
Hi, I see that "krysma" already remind this feature. Please revise changes and decide next steps. I synced it with master, so now it is without conflicts. |
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.
looks fine, apart from comments
@@ -984,6 +984,7 @@ def put( | |||
data_columns: Optional[List[str]] = None, | |||
encoding=None, | |||
errors: str = "strict", | |||
track_times: bool = True, |
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 update the doc-string, make sure to add a 1.1 versionadded tag
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.
doc string added
7c9661c
to
a5b46df
Compare
thanks @rbenes |
Hi, trying to use track_times=False I add to look at all the options used in the test, so that I found that index=None is needed in order to indeed obtain reproducible files. |
I implement feature request #32682 but if someone has more experience with pytables consider these changes.
The h5 files generated with track_times=False has the same md5 hashes, that is covered in the unit test as well as the fact that the hashes are not the same with track_times=True
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff