Skip to content

Commit 2e5edba

Browse files
Pin numpy version (#49)
1 parent a297909 commit 2e5edba

10 files changed

Lines changed: 34 additions & 23 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ["3.8", "3.9", "3.10"]
16+
python-version: ["3.9", "3.10", "3.11"]
1717

1818
steps:
1919
- uses: actions/checkout@v2

.github/workflows/deploy_public.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v3
3737

38-
- name: Set up Python 3.9
38+
- name: Set up Python 3.10
3939
uses: actions/setup-python@v4
4040
with:
41-
python-version: "3.9"
41+
python-version: "3.10"
4242

4343
- name: Install dependencies
4444
run: |

docs/user_guide/concepts_utils/data_source.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ next time it is requested.
9292
drio_client,
9393
labels,
9494
cache='.cache'
95-
cache_size=pd.to_timedelta("3H")
95+
cache_size=pd.to_timedelta("3h")
9696
)
9797
9898
.. tip::
@@ -137,7 +137,7 @@ the index is datetime-like, fixed-frequency start and end index pairs can be gen
137137
138138
139139
start, end = iter_index.date_range(
140-
start="2020-01-01 00:00", end="2020-02-01 00:00", freq="1H"
140+
start="2020-01-01 00:00", end="2020-02-01 00:00", freq="1h"
141141
)
142142
143143
for index_i, data_i in source.iter(start, end):

docs/user_guide/concepts_utils/example.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ are stored in *Azure Blob Storage* using the :class:`~fourinsight.engineroom.uti
7373
end = pd.to_datetime("now", utc=True)
7474
7575
# Iterate over the data in 1-hour chunks
76-
for index_i, data_i in source.iter(*iter_index.date_range(start, end, freq="1H")):
76+
for index_i, data_i in source.iter(*iter_index.date_range(start, end, freq="1h")):
7777
results.new_row(index_i)
7878
7979
series_a = data_i["A"]

fourinsight/engineroom/utils/_core.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,11 @@ def pull(self, raise_on_missing=True, strict=True):
458458

459459
self._handler.seek(0)
460460
df_source = pd.read_csv(
461-
self._handler, index_col=0, parse_dates=True, dtype=self._headers
461+
self._handler,
462+
index_col=0,
463+
parse_dates=True,
464+
dtype=self._headers,
465+
date_format="ISO8601",
462466
)
463467

464468
if strict and set(df_source.columns) != set(self._headers.keys()):

fourinsight/engineroom/utils/_datamanage.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ class DrioDataSource(BaseDataSource):
526526
cache : str, optional
527527
Cache folder. If ``None`` (default), caching is disabled.
528528
cache_size :
529-
Cache size as an index partition (see Notes). Defaults to ``'24H'`` if the
529+
Cache size as an index partition (see Notes). Defaults to ``'24h'`` if the
530530
`index_type` is 'datetime', otherwise ``None`` is default.
531531
**get_kwargs : optional
532532
Keyword arguments that will be passed on to the ``drio_client.get`` method.
@@ -578,7 +578,7 @@ def __init__(
578578

579579
if index_type == "datetime":
580580
index_converter = DatetimeIndexConverter()
581-
cache_size = cache_size or "24H"
581+
cache_size = cache_size or "24h"
582582
elif index_type == "integer":
583583
index_converter = IntegerIndexConverter()
584584
elif isinstance(index_type, BaseIndexConverter):
@@ -798,4 +798,10 @@ def get(self, start, end, refresh_cache=False):
798798
source_i.get(start_i, end_i, refresh_cache=refresh_cache)
799799
for (start_i, end_i), source_i in zip(pairwise(index_list), sources_list)
800800
]
801+
802+
data_list = [df.dropna(how="all", axis=1) for df in data_list if not df.empty]
803+
804+
if not data_list:
805+
return pd.DataFrame([], columns=self._labels)
806+
801807
return pd.concat(data_list).infer_objects()

setup.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ url = https://4insight.io/
1010
classifiers =
1111
License :: OSI Approved :: MIT License
1212
Operating System :: OS Independent
13-
Programming Language :: Python :: 3.8
1413
Programming Language :: Python :: 3.9
1514
Programming Language :: Python :: 3.10
15+
Programming Language :: Python :: 3.11
1616

1717
[options]
1818
packages = find_namespace:
19-
python_requires = >=3.8
19+
python_requires = >=3.9
2020
install_requires =
2121
pandas
2222
azure-storage-blob >= 12.4.0
2323
pyarrow
24+
numpy < 2.0.0
2425

2526
[options.packages.find]
2627
include =

tests/test_datamanage.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ def test_partition_start_end_float(self):
689689
def test_partition_start_end_datetime(self):
690690
start = pd.to_datetime("2020-01-01 03:00", utc=True)
691691
end = pd.to_datetime("2020-01-01 09:00", utc=True)
692-
partition = pd.to_timedelta("3H")
692+
partition = pd.to_timedelta("3h")
693693
reference = pd.to_datetime("2020-01-01 02:00", utc=True)
694694
out = BaseDataSourceForTesting._partition_start_end(
695695
start, end, partition, reference
@@ -705,15 +705,15 @@ def test_partition_start_end_datetime(self):
705705
def test__is_cached_false(self, tmp_path):
706706
cache_dir = tmp_path / ".cache"
707707
source = BaseDataSourceForTesting(
708-
DatetimeIndexConverter(), cache=cache_dir, cache_size="1H"
708+
DatetimeIndexConverter(), cache=cache_dir, cache_size="1h"
709709
)
710710
assert cache_dir.exists()
711711
assert source._is_cached("filename") is False
712712

713713
def test__is_cached_true(self, tmp_path):
714714
cache_dir = tmp_path / ".cache"
715715
source = BaseDataSourceForTesting(
716-
DatetimeIndexConverter(), cache=cache_dir, cache_size="1H"
716+
DatetimeIndexConverter(), cache=cache_dir, cache_size="1h"
717717
)
718718
assert cache_dir.exists()
719719
(cache_dir / "filename").touch()
@@ -722,7 +722,7 @@ def test__is_cached_true(self, tmp_path):
722722
def test__cache_read(self, tmp_path):
723723
cache_dir = tmp_path / ".cache"
724724
source = BaseDataSourceForTesting(
725-
DatetimeIndexConverter(), cache=cache_dir, cache_size="1H"
725+
DatetimeIndexConverter(), cache=cache_dir, cache_size="1h"
726726
)
727727

728728
df = pd.DataFrame(data={"filename": [2, 4, 6], "a": [1, 2, 3]})
@@ -735,7 +735,7 @@ def test__cache_read(self, tmp_path):
735735
def test__cache_write(self, tmp_path):
736736
cache_dir = tmp_path / ".cache"
737737
source = BaseDataSourceForTesting(
738-
DatetimeIndexConverter(), cache=cache_dir, cache_size="1H"
738+
DatetimeIndexConverter(), cache=cache_dir, cache_size="1h"
739739
)
740740

741741
df = pd.DataFrame(data={"a": [1, 2, 3]}, index=[2, 4, 6])
@@ -967,7 +967,7 @@ def test__init__(self, tmp_path):
967967
assert source._get_kwargs == {"convert_date": False, "raise_empty": True}
968968
assert isinstance(source._index_converter, DatetimeIndexConverter)
969969
assert source._cache == Path(cache_dir)
970-
assert source._cache_size == pd.to_timedelta("24H")
970+
assert source._cache_size == pd.to_timedelta("24h")
971971

972972
def test__init__integer(self):
973973
drio_client = Mock()
@@ -1579,15 +1579,15 @@ def test_to_universal_index_arraylike(self):
15791579
np.testing.assert_array_equal(out, expect)
15801580

15811581
def test_to_universal_delta(self):
1582-
out = DatetimeIndexConverter().to_universal_delta("3H")
1583-
expect = pd.to_timedelta("3H")
1582+
out = DatetimeIndexConverter().to_universal_delta("3h")
1583+
expect = pd.to_timedelta("3h")
15841584
assert out == expect
15851585

15861586
def test_to_universal_delta_arraylike(self):
15871587
out = DatetimeIndexConverter().to_universal_delta(
1588-
["3H", "24H", pd.to_timedelta("2D")]
1588+
["3h", "24h", pd.to_timedelta("2D")]
15891589
)
1590-
expect = pd.to_timedelta(["3H", "24H", pd.to_timedelta("2D")])
1590+
expect = pd.to_timedelta(["3h", "24h", pd.to_timedelta("2D")])
15911591
np.testing.assert_array_equal(out, expect)
15921592

15931593
def test_to_native_index(self):

tests/test_iter_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Test_date_range:
77
def test_start_end_freq(self):
88
start = "2020-01-01 00:00"
99
end = "2020-01-01 05:00"
10-
freq = "1H"
10+
freq = "1h"
1111
start_out, end_out = iter_index.date_range(start=start, end=end, freq=freq)
1212

1313
date_range = pd.date_range(start=start, end=end, freq=freq)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ deps =
1212
pytest-cov
1313

1414
[testenv:docs]
15-
basepython = python3.9
15+
basepython = python3.10
1616
commands = sphinx-build -W -b html -d {toxworkdir}/docs_doctree docs {toxworkdir}/docs_out
1717
deps =
1818
sphinx == 5.3.0

0 commit comments

Comments
 (0)