From a431e31a72a5289e64cfd855f77003cd0c4f7c28 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Sat, 14 Mar 2020 14:56:13 +0100 Subject: [PATCH 01/15] Propagate track times --- pandas/io/pytables.py | 7 ++++- pandas/tests/io/pytables/test_store.py | 37 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 345402e619ff2..310aceb62c208 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -984,6 +984,7 @@ def put( data_columns: Optional[List[str]] = None, encoding=None, errors: str = "strict", + track_times: bool = True, ): """ Store object in HDFStore. @@ -1027,6 +1028,7 @@ def put( data_columns=data_columns, encoding=encoding, errors=errors, + track_times=track_times, ) def remove(self, key: str, where=None, start=None, stop=None): @@ -1626,6 +1628,7 @@ def _write_to_group( data_columns=None, encoding=None, errors: str = "strict", + track_times: bool = True, ): group = self.get_node(key) @@ -1688,6 +1691,7 @@ def _write_to_group( dropna=dropna, nan_rep=nan_rep, data_columns=data_columns, + track_times=track_times, ) if isinstance(s, Table) and index: @@ -4106,6 +4110,7 @@ def write( dropna=False, nan_rep=None, data_columns=None, + track_times=True, ): if not append and self.is_exists: @@ -4138,7 +4143,7 @@ def write( table.set_attrs() # create the table - table._handle.create_table(table.group, **options) + table._handle.create_table(table.group, track_times=track_times, **options) # update my info table.attrs.info = table.info diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index c937f9ac42818..e2d4ba0074b58 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -296,6 +296,43 @@ def test_keys(self, setup_path): assert set(store.keys()) == expected assert set(store) == expected + def test_no_track_times(self, setup_path): + + # GH 32682 + # enables to set track_times (see `pytables` `create_table` documentation) + + import hashlib + import time + + def checksum(filename, hash_factory=hashlib.md5, chunk_num_blocks=128): + h = hash_factory() + with open(filename, 'rb') as f: + for chunk in iter(lambda: f.read(chunk_num_blocks * h.block_size), b''): + h.update(chunk) + return h.digest() + + def create_h5_and_return_checksum(): + with ensure_clean_path(setup_path) as path: + df = pd.DataFrame({"a": [1]}) + + hdf = pd.HDFStore(path, mode="w") + hdf.put( + "table", + df, + format='table', + data_columns=True, + index=None, + track_times=False, + ) + hdf.close() + return checksum(path) + + checksum_0 = create_h5_and_return_checksum() + time.sleep(1) + checksum_1 = create_h5_and_return_checksum() + + assert checksum_0 == checksum_1 + def test_keys_ignore_hdf_softlink(self, setup_path): # GH 20523 From acbd5b404a8c84b8b6cf12e149db894efa81f745 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Sat, 14 Mar 2020 15:13:47 +0100 Subject: [PATCH 02/15] Make both tests --- pandas/tests/io/pytables/test_store.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index e2d4ba0074b58..be7e397510621 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -311,7 +311,7 @@ def checksum(filename, hash_factory=hashlib.md5, chunk_num_blocks=128): h.update(chunk) return h.digest() - def create_h5_and_return_checksum(): + def create_h5_and_return_checksum(track_times): with ensure_clean_path(setup_path) as path: df = pd.DataFrame({"a": [1]}) @@ -322,16 +322,22 @@ def create_h5_and_return_checksum(): format='table', data_columns=True, index=None, - track_times=False, + track_times=track_times, ) hdf.close() return checksum(path) - checksum_0 = create_h5_and_return_checksum() + checksum_0_tt_false = create_h5_and_return_checksum(track_times=False) + checksum_0_tt_true = create_h5_and_return_checksum(track_times=True) time.sleep(1) - checksum_1 = create_h5_and_return_checksum() + checksum_1_tt_false = create_h5_and_return_checksum(track_times=False) + checksum_1_tt_true = create_h5_and_return_checksum(track_times=True) - assert checksum_0 == checksum_1 + # checksums are the same if track_time = False + assert checksum_0_tt_false == checksum_1_tt_false + + # checksums are NOT same if track_time = True + assert checksum_0_tt_true != checksum_1_tt_true def test_keys_ignore_hdf_softlink(self, setup_path): From 8a374de828a3088dcf95a7433f7ed12ac1497fae Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Sat, 14 Mar 2020 15:19:02 +0100 Subject: [PATCH 03/15] Unify --- pandas/tests/io/pytables/test_store.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index be7e397510621..a248e11d18860 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -306,7 +306,7 @@ def test_no_track_times(self, setup_path): def checksum(filename, hash_factory=hashlib.md5, chunk_num_blocks=128): h = hash_factory() - with open(filename, 'rb') as f: + with open(filename, "rb") as f: for chunk in iter(lambda: f.read(chunk_num_blocks * h.block_size), b''): h.update(chunk) return h.digest() @@ -319,7 +319,7 @@ def create_h5_and_return_checksum(track_times): hdf.put( "table", df, - format='table', + format="table", data_columns=True, index=None, track_times=track_times, From 5a05b5cf493870f60af84516eaab9eb42cc7b9fd Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Sat, 14 Mar 2020 15:22:27 +0100 Subject: [PATCH 04/15] Note --- pandas/tests/io/pytables/test_store.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index a248e11d18860..bc44b6790ce80 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -329,7 +329,10 @@ def create_h5_and_return_checksum(track_times): checksum_0_tt_false = create_h5_and_return_checksum(track_times=False) checksum_0_tt_true = create_h5_and_return_checksum(track_times=True) + + # sleep is necessary to create h5 with different creation time time.sleep(1) + checksum_1_tt_false = create_h5_and_return_checksum(track_times=False) checksum_1_tt_true = create_h5_and_return_checksum(track_times=True) From 2f611401e52a9e737e4e14800351518b0c660901 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Sun, 15 Mar 2020 13:45:51 +0100 Subject: [PATCH 05/15] Black --- pandas/tests/io/pytables/test_store.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index bc44b6790ce80..bfe3bb9abbfc6 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -307,7 +307,7 @@ def test_no_track_times(self, setup_path): def checksum(filename, hash_factory=hashlib.md5, chunk_num_blocks=128): h = hash_factory() with open(filename, "rb") as f: - for chunk in iter(lambda: f.read(chunk_num_blocks * h.block_size), b''): + for chunk in iter(lambda: f.read(chunk_num_blocks * h.block_size), b""): h.update(chunk) return h.digest() From eb9a4c2a84db5203aeaf5f874464955ce72200dc Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Sun, 15 Mar 2020 15:11:11 +0100 Subject: [PATCH 06/15] Make it tables < 3.4.3 friendly --- pandas/io/pytables.py | 19 +++++++--- pandas/tests/io/pytables/test_store.py | 49 +++++++++++++++----------- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 310aceb62c208..49190488daf23 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -984,7 +984,7 @@ def put( data_columns: Optional[List[str]] = None, encoding=None, errors: str = "strict", - track_times: bool = True, + track_times: Optional[bool] = None, ): """ Store object in HDFStore. @@ -1628,7 +1628,7 @@ def _write_to_group( data_columns=None, encoding=None, errors: str = "strict", - track_times: bool = True, + track_times: Optional[bool] = None, ): group = self.get_node(key) @@ -4110,7 +4110,7 @@ def write( dropna=False, nan_rep=None, data_columns=None, - track_times=True, + track_times=None, ): if not append and self.is_exists: @@ -4142,8 +4142,19 @@ 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 + + if Version(tables_version) >= Version("3.4.3"): + options["track_times"] = track_times + else: + raise ValueError( + "You cannot set track_times with table version < 3.4.3" + ) + # create the table - table._handle.create_table(table.group, track_times=track_times, **options) + table._handle.create_table(table.group, **options) # update my info table.attrs.info = table.info diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index bfe3bb9abbfc6..f581c20c90d11 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -303,6 +303,8 @@ def test_no_track_times(self, setup_path): import hashlib import time + import tables + from packaging.version import Version def checksum(filename, hash_factory=hashlib.md5, chunk_num_blocks=128): h = hash_factory() @@ -315,32 +317,39 @@ def create_h5_and_return_checksum(track_times): with ensure_clean_path(setup_path) as path: df = pd.DataFrame({"a": [1]}) - hdf = pd.HDFStore(path, mode="w") - hdf.put( - "table", - df, - format="table", - data_columns=True, - index=None, - track_times=track_times, - ) - hdf.close() + with pd.HDFStore(path, mode="w") as hdf: + hdf.put( + "table", + df, + format="table", + data_columns=True, + index=None, + track_times=track_times, + ) + return checksum(path) - checksum_0_tt_false = create_h5_and_return_checksum(track_times=False) - checksum_0_tt_true = create_h5_and_return_checksum(track_times=True) + if Version(tables.__version__) < Version("3.4.3"): + with pytest.raises( + ValueError, + match="You cannot set track_times with table version < 3.4.3", + ): + create_h5_and_return_checksum(track_times=False) + else: + checksum_0_tt_false = create_h5_and_return_checksum(track_times=False) + checksum_0_tt_true = create_h5_and_return_checksum(track_times=True) - # sleep is necessary to create h5 with different creation time - time.sleep(1) + # sleep is necessary to create h5 with different creation time + time.sleep(1) - checksum_1_tt_false = create_h5_and_return_checksum(track_times=False) - checksum_1_tt_true = create_h5_and_return_checksum(track_times=True) + checksum_1_tt_false = create_h5_and_return_checksum(track_times=False) + checksum_1_tt_true = create_h5_and_return_checksum(track_times=True) - # checksums are the same if track_time = False - assert checksum_0_tt_false == checksum_1_tt_false + # checksums are the same if track_time = False + assert checksum_0_tt_false == checksum_1_tt_false - # checksums are NOT same if track_time = True - assert checksum_0_tt_true != checksum_1_tt_true + # checksums are NOT same if track_time = True + assert checksum_0_tt_true != checksum_1_tt_true def test_keys_ignore_hdf_softlink(self, setup_path): From ebbf5ba808b6ac5bc4bfb1639475cacf7b9995a1 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Mon, 16 Mar 2020 06:56:12 +0100 Subject: [PATCH 07/15] Use LooseVersion --- pandas/io/pytables.py | 4 ++-- pandas/tests/io/pytables/test_store.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 49190488daf23..392a64f27c701 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -4144,9 +4144,9 @@ def write( if track_times is not None: from tables import __version__ as tables_version - from packaging.version import Version + from distutils.version import LooseVersion - if Version(tables_version) >= Version("3.4.3"): + if LooseVersion(tables_version) >= LooseVersion("3.4.3"): options["track_times"] = track_times else: raise ValueError( diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index f581c20c90d11..04312d19c52a6 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -304,7 +304,6 @@ def test_no_track_times(self, setup_path): import hashlib import time import tables - from packaging.version import Version def checksum(filename, hash_factory=hashlib.md5, chunk_num_blocks=128): h = hash_factory() @@ -329,7 +328,7 @@ def create_h5_and_return_checksum(track_times): return checksum(path) - if Version(tables.__version__) < Version("3.4.3"): + if LooseVersion(tables.__version__) < LooseVersion("3.4.3"): with pytest.raises( ValueError, match="You cannot set track_times with table version < 3.4.3", From a3ff426ca3e7e816c245c4a897e4099fe0140aad Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Mon, 16 Mar 2020 07:00:27 +0100 Subject: [PATCH 08/15] Use default true. Be silent if unsupported pytables --- pandas/io/pytables.py | 10 +++------- pandas/tests/io/pytables/test_store.py | 8 +------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 392a64f27c701..743a7c69d4b18 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -984,7 +984,7 @@ def put( data_columns: Optional[List[str]] = None, encoding=None, errors: str = "strict", - track_times: Optional[bool] = None, + track_times: bool = True, ): """ Store object in HDFStore. @@ -1628,7 +1628,7 @@ def _write_to_group( data_columns=None, encoding=None, errors: str = "strict", - track_times: Optional[bool] = None, + track_times: bool = True, ): group = self.get_node(key) @@ -4110,7 +4110,7 @@ def write( dropna=False, nan_rep=None, data_columns=None, - track_times=None, + track_times=True, ): if not append and self.is_exists: @@ -4148,10 +4148,6 @@ def write( if LooseVersion(tables_version) >= LooseVersion("3.4.3"): options["track_times"] = track_times - else: - raise ValueError( - "You cannot set track_times with table version < 3.4.3" - ) # create the table table._handle.create_table(table.group, **options) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index 04312d19c52a6..94927abaa9eca 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -328,13 +328,7 @@ def create_h5_and_return_checksum(track_times): return checksum(path) - if LooseVersion(tables.__version__) < LooseVersion("3.4.3"): - with pytest.raises( - ValueError, - match="You cannot set track_times with table version < 3.4.3", - ): - create_h5_and_return_checksum(track_times=False) - else: + if LooseVersion(tables.__version__) >= LooseVersion("3.4.3"): checksum_0_tt_false = create_h5_and_return_checksum(track_times=False) checksum_0_tt_true = create_h5_and_return_checksum(track_times=True) From 190c9e4f2926a73f1dfd21671712e40c71e34ab6 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Mon, 16 Mar 2020 07:04:29 +0100 Subject: [PATCH 09/15] Imports arranged --- pandas/io/pytables.py | 10 ++++------ pandas/tests/io/pytables/test_store.py | 7 +++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 743a7c69d4b18..f592914189861 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -5,6 +5,7 @@ import copy from datetime import date, tzinfo +from distutils.version import LooseVersion import itertools import os import re @@ -12,6 +13,7 @@ import warnings import numpy as np +from tables import __version__ as tables_version from pandas._config import config, get_option @@ -4142,12 +4144,8 @@ def write( # set the table attributes table.set_attrs() - if track_times is not None: - from tables import __version__ as tables_version - from distutils.version import LooseVersion - - if LooseVersion(tables_version) >= LooseVersion("3.4.3"): - options["track_times"] = track_times + if LooseVersion(tables_version) >= LooseVersion("3.4.3"): + options["track_times"] = track_times # create the table table._handle.create_table(table.group, **options) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index 94927abaa9eca..e07d522e5a9f0 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -1,14 +1,17 @@ import datetime from datetime import timedelta from distutils.version import LooseVersion +import hashlib from io import BytesIO import os from pathlib import Path import re +import time from warnings import catch_warnings, simplefilter import numpy as np import pytest +import tables from pandas.compat import is_platform_little_endian, is_platform_windows import pandas.util._test_decorators as td @@ -301,10 +304,6 @@ def test_no_track_times(self, setup_path): # GH 32682 # enables to set track_times (see `pytables` `create_table` documentation) - import hashlib - import time - import tables - def checksum(filename, hash_factory=hashlib.md5, chunk_num_blocks=128): h = hash_factory() with open(filename, "rb") as f: From 7a9071830471590c68b7485f9c68a7c17aeaa0d0 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Mon, 16 Mar 2020 07:10:23 +0100 Subject: [PATCH 10/15] Mark test as skipif --- pandas/tests/io/pytables/test_store.py | 28 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index e07d522e5a9f0..01ecd81cb9ce2 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -299,6 +299,13 @@ def test_keys(self, setup_path): assert set(store.keys()) == expected assert set(store) == expected + @pytest.mark.skipif( + LooseVersion(tables.__version__) < LooseVersion("3.4.3"), + reason=( + "Skipping pytables test when tables version is " + "lower than 3.4.3" + ), + ) def test_no_track_times(self, setup_path): # GH 32682 @@ -327,21 +334,20 @@ def create_h5_and_return_checksum(track_times): return checksum(path) - if LooseVersion(tables.__version__) >= LooseVersion("3.4.3"): - checksum_0_tt_false = create_h5_and_return_checksum(track_times=False) - checksum_0_tt_true = create_h5_and_return_checksum(track_times=True) + checksum_0_tt_false = create_h5_and_return_checksum(track_times=False) + checksum_0_tt_true = create_h5_and_return_checksum(track_times=True) - # sleep is necessary to create h5 with different creation time - time.sleep(1) + # sleep is necessary to create h5 with different creation time + time.sleep(1) - checksum_1_tt_false = create_h5_and_return_checksum(track_times=False) - checksum_1_tt_true = create_h5_and_return_checksum(track_times=True) + checksum_1_tt_false = create_h5_and_return_checksum(track_times=False) + checksum_1_tt_true = create_h5_and_return_checksum(track_times=True) - # checksums are the same if track_time = False - assert checksum_0_tt_false == checksum_1_tt_false + # checksums are the same if track_time = False + assert checksum_0_tt_false == checksum_1_tt_false - # checksums are NOT same if track_time = True - assert checksum_0_tt_true != checksum_1_tt_true + # checksums are NOT same if track_time = True + assert checksum_0_tt_true != checksum_1_tt_true def test_keys_ignore_hdf_softlink(self, setup_path): From dc5566fc1cae585978fc7efcf8f91d7b9582df46 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Mon, 16 Mar 2020 07:24:07 +0100 Subject: [PATCH 11/15] Avoid importing tables --- pandas/tests/io/pytables/test_store.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index 01ecd81cb9ce2..a1d50c47d1ec3 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -11,7 +11,6 @@ import numpy as np import pytest -import tables from pandas.compat import is_platform_little_endian, is_platform_windows import pandas.util._test_decorators as td From 99b99e1cdda791f3799475afd34dfa7fabb33e66 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Mon, 16 Mar 2020 08:16:01 +0100 Subject: [PATCH 12/15] Revert import tables back to function --- pandas/io/pytables.py | 2 +- pandas/tests/io/pytables/test_store.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index f592914189861..b5f03934a2cb3 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -13,7 +13,6 @@ import warnings import numpy as np -from tables import __version__ as tables_version from pandas._config import config, get_option @@ -4114,6 +4113,7 @@ def write( data_columns=None, track_times=True, ): + from tables import __version__ as tables_version if not append and self.is_exists: self._handle.remove_node(self.group, "table") diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index a1d50c47d1ec3..b5f542dc604f1 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -300,10 +300,7 @@ def test_keys(self, setup_path): @pytest.mark.skipif( LooseVersion(tables.__version__) < LooseVersion("3.4.3"), - reason=( - "Skipping pytables test when tables version is " - "lower than 3.4.3" - ), + reason=("Skipping pytables test when tables version is lower than 3.4.3"), ) def test_no_track_times(self, setup_path): From df98a7bae48a573fa9fbddbdb38befb00de49e93 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Fri, 17 Apr 2020 13:09:27 +0200 Subject: [PATCH 13/15] No need for handling of pytables version --- pandas/io/pytables.py | 6 +----- pandas/tests/io/pytables/test_store.py | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index b5f03934a2cb3..3229518dda7c0 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -5,7 +5,6 @@ import copy from datetime import date, tzinfo -from distutils.version import LooseVersion import itertools import os import re @@ -4113,8 +4112,6 @@ def write( data_columns=None, track_times=True, ): - from tables import __version__ as tables_version - if not append and self.is_exists: self._handle.remove_node(self.group, "table") @@ -4144,8 +4141,7 @@ def write( # set the table attributes table.set_attrs() - if LooseVersion(tables_version) >= LooseVersion("3.4.3"): - options["track_times"] = track_times + options["track_times"] = track_times # create the table table._handle.create_table(table.group, **options) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index b5f542dc604f1..fe59b989bab7e 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -298,10 +298,6 @@ def test_keys(self, setup_path): assert set(store.keys()) == expected assert set(store) == expected - @pytest.mark.skipif( - LooseVersion(tables.__version__) < LooseVersion("3.4.3"), - reason=("Skipping pytables test when tables version is lower than 3.4.3"), - ) def test_no_track_times(self, setup_path): # GH 32682 From f1fda881d7648a71637c860edc7b15d60f62b0be Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Fri, 17 Apr 2020 13:22:44 +0200 Subject: [PATCH 14/15] Whats new added --- doc/source/whatsnew/v1.1.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/whatsnew/v1.1.0.rst b/doc/source/whatsnew/v1.1.0.rst index 5c74965bffdd7..1437006ee3fb8 100644 --- a/doc/source/whatsnew/v1.1.0.rst +++ b/doc/source/whatsnew/v1.1.0.rst @@ -234,6 +234,7 @@ Other enhancements compression library. Compression was also added to the low-level Stata-file writers :class:`~pandas.io.stata.StataWriter`, :class:`~pandas.io.stata.StataWriter117`, and :class:`~pandas.io.stata.StataWriterUTF8` (:issue:`26599`). +- :meth:`HDFStore.put` now accepts `track_times` parameter. Parameter is passed to ``create_table`` method of ``PyTables`` (:issue:`32682`). .. --------------------------------------------------------------------------- From d76fb3700a330b8c62b817199f1d09d6c64084e9 Mon Sep 17 00:00:00 2001 From: Radek Benes Date: Thu, 14 May 2020 10:02:41 +0200 Subject: [PATCH 15/15] Docstring added --- pandas/io/pytables.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 3229518dda7c0..85fcfd107b121 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -1011,6 +1011,12 @@ def put( Provide an encoding for strings. dropna : bool, default False, do not write an ALL nan row to The store settable by the option 'io.hdf.dropna_table'. + track_times : bool, default True + Parameter is propagated to 'create_table' method of 'PyTables'. + If set to False it enables to have the same h5 files (same hashes) + independent on creation time. + + .. versionadded:: 1.1.0 """ if format is None: format = get_option("io.hdf.default_format") or "fixed"