Skip to content

Commit 5146013

Browse files
authored
fix: handle missing time index (#190)
1 parent fc9f1ba commit 5146013

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

meteostat/__init__.py

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

1414
__appname__ = "meteostat"
15-
__version__ = "1.7.1"
15+
__version__ = "1.7.2"
1616

1717
from .interface.base import Base
1818
from .interface.timeseries import TimeSeries

meteostat/utilities/mutations.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def filter_time(
3434
# Get time index
3535
time = df.index.get_level_values("time")
3636

37+
# If no time index, return original DataFrame
38+
if len(time) == 0:
39+
return df
40+
3741
# Filter & return
3842
return df.loc[(time >= start) & (time <= end)] if start and end else df
3943

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Setup
1616
setup(
1717
name="meteostat",
18-
version="1.7.1",
18+
version="1.7.2",
1919
author="Meteostat",
2020
author_email="[email protected]",
2121
description="Access and analyze historical weather and climate data with Python.",

0 commit comments

Comments
 (0)