toolbox-utils 5.2.0__tar.gz → 5.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/.github/workflows/pypi-package.yml +2 -2
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/.github/workflows/tests.yml +2 -2
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/.pre-commit-config.yaml +5 -5
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/CHANGELOG.md +14 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/PKG-INFO +1 -1
- toolbox_utils-5.2.2/VERSION +1 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/pyproject.toml +1 -1
- toolbox_utils-5.2.2/src/toolbox_utils/readers/plotgen.py +45 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils/tsutils.py +130 -11
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/PKG-INFO +1 -1
- toolbox_utils-5.2.2/tests/data_plotgen.plt +758 -0
- toolbox_utils-5.2.0/VERSION +0 -1
- toolbox_utils-5.2.0/src/toolbox_utils/readers/plotgen.py +0 -55
- toolbox_utils-5.2.0/tests/data_plotgen.plt +0 -758
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/.deepsource.toml +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/.github/dependabot.yml +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/.github/workflows/clean-workflow-runs.yml +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/.gitignore +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/.sourcery.yaml +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/AUTHORS.rst +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/BADGES.rst +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/CONTRIBUTING.rst +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/LICENSE.txt +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/README.rst +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/docs/Makefile +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/docs/authors.rst +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/docs/conf.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/docs/contributing.rst +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/docs/index.rst +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/docs/license.rst +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/docs/make.bat +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/docs/readme.rst +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/setup.cfg +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils/__init__.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils/readers/__init__.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils/readers/hbn.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils/readers/wdm.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/SOURCES.txt +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/dependency_links.txt +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/requires.txt +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/top_level.txt +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data.wdm +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_bi_daily.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_bivl.hbn +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_end.bivl.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_end.daily.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_end.monthly.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_end.yearly.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_flow_stage.xlsx +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_period.bivl.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_period.daily.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_period.monthly.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_period.yearly.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_simple.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_start.bivl.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_start.daily.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_start.monthly.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_start.yearly.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_wdm_1.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_wdm_2.csv +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/data_yearly.hbn +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_asbestfreq.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_date_slice.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_dateparse.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_extract.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_hbn.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_make_list.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_period_timestamp.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_plotgen.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_range_to_numlist.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_read.py +0 -0
- {toolbox_utils-5.2.0 → toolbox_utils-5.2.2}/tests/test_wdm.py +0 -0
|
@@ -28,7 +28,7 @@ jobs:
|
|
|
28
28
|
|
|
29
29
|
steps:
|
|
30
30
|
- name: Checkout source
|
|
31
|
-
uses: actions/checkout@
|
|
31
|
+
uses: actions/checkout@v5
|
|
32
32
|
with:
|
|
33
33
|
submodules: recursive
|
|
34
34
|
|
|
@@ -38,7 +38,7 @@ jobs:
|
|
|
38
38
|
python -m build
|
|
39
39
|
|
|
40
40
|
- name: Download artifact
|
|
41
|
-
uses: actions/download-artifact@
|
|
41
|
+
uses: actions/download-artifact@v6
|
|
42
42
|
with:
|
|
43
43
|
path: dist
|
|
44
44
|
merge-multiple: true
|
|
@@ -55,12 +55,12 @@ jobs:
|
|
|
55
55
|
|
|
56
56
|
steps:
|
|
57
57
|
- name: Checkout repository
|
|
58
|
-
uses: actions/checkout@
|
|
58
|
+
uses: actions/checkout@v5
|
|
59
59
|
with:
|
|
60
60
|
submodules: recursive
|
|
61
61
|
|
|
62
62
|
- name: Set up Python ${{ matrix.python-versions }}
|
|
63
|
-
uses: actions/setup-python@
|
|
63
|
+
uses: actions/setup-python@v6
|
|
64
64
|
with:
|
|
65
65
|
python-version: ${{ matrix.python-versions }}
|
|
66
66
|
|
|
@@ -31,7 +31,7 @@ repos:
|
|
|
31
31
|
|
|
32
32
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
33
33
|
# Ruff version.
|
|
34
|
-
rev: v0.
|
|
34
|
+
rev: v0.12.0
|
|
35
35
|
hooks:
|
|
36
36
|
# Run the linter.
|
|
37
37
|
- id: ruff
|
|
@@ -42,7 +42,7 @@ repos:
|
|
|
42
42
|
types_or: [python, pyi, jupyter]
|
|
43
43
|
|
|
44
44
|
- repo: https://github.com/pycqa/isort
|
|
45
|
-
rev: 6.0.
|
|
45
|
+
rev: 6.0.1
|
|
46
46
|
hooks:
|
|
47
47
|
- id: isort
|
|
48
48
|
name: isort (python)
|
|
@@ -60,7 +60,7 @@ repos:
|
|
|
60
60
|
args: [--in-place, --spaces-indent-inline-array, '4']
|
|
61
61
|
|
|
62
62
|
- repo: https://github.com/adrienverge/yamllint.git
|
|
63
|
-
rev: v1.
|
|
63
|
+
rev: v1.37.1
|
|
64
64
|
hooks:
|
|
65
65
|
- id: yamllint
|
|
66
66
|
args: [--format, parsable, --strict]
|
|
@@ -88,12 +88,12 @@ repos:
|
|
|
88
88
|
- id: blacken-docs
|
|
89
89
|
|
|
90
90
|
- repo: https://github.com/asottile/pyupgrade
|
|
91
|
-
rev: v3.
|
|
91
|
+
rev: v3.20.0
|
|
92
92
|
hooks:
|
|
93
93
|
- id: pyupgrade
|
|
94
94
|
|
|
95
95
|
- repo: https://github.com/commitizen-tools/commitizen
|
|
96
|
-
rev: v4.
|
|
96
|
+
rev: v4.8.3
|
|
97
97
|
hooks:
|
|
98
98
|
- id: commitizen
|
|
99
99
|
stages: [commit-msg]
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## v5.2.2 (2025-11-13)
|
|
2
|
+
|
|
3
|
+
### Fix
|
|
4
|
+
|
|
5
|
+
- use .where instead of .replace to avoid RecursionError in pandas 1.5.x
|
|
6
|
+
- fixed PLTGEN reader
|
|
7
|
+
|
|
8
|
+
## v5.2.1 (2025-07-20)
|
|
9
|
+
|
|
10
|
+
### Fix
|
|
11
|
+
|
|
12
|
+
- fix entries in pandas_offset_by_version
|
|
13
|
+
- use pandas_offset_by_version to set offsets within toolbox_utils
|
|
14
|
+
|
|
1
15
|
## v5.2.0 (2025-05-10)
|
|
2
16
|
|
|
3
17
|
### Feat
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5.2.2
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""For reading HSPF plotgen files."""
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def plotgen_extract(filename):
|
|
7
|
+
"""Reads HSPF PLTGEN files and creates a DataFrame."""
|
|
8
|
+
found_column_names = False
|
|
9
|
+
column_names = []
|
|
10
|
+
with open(filename, encoding="ascii") as fpointer:
|
|
11
|
+
for i, line in enumerate(fpointer):
|
|
12
|
+
if "LINTYP" in line:
|
|
13
|
+
found_column_names = True
|
|
14
|
+
continue
|
|
15
|
+
if line[5:].startswith("Time series"):
|
|
16
|
+
break
|
|
17
|
+
if found_column_names:
|
|
18
|
+
if column_name := line[4:30].strip():
|
|
19
|
+
column_names.append(column_name)
|
|
20
|
+
continue
|
|
21
|
+
|
|
22
|
+
pgdf = pd.read_fwf(
|
|
23
|
+
fpointer,
|
|
24
|
+
colspecs=[(5, 10), (10, 13), (13, 16), (16, 19), (19, 22)]
|
|
25
|
+
+ [(22 + i * 14, 36 + i * 14) for i in range(len(column_names))],
|
|
26
|
+
skiprows=3,
|
|
27
|
+
names=["Year", "Month", "Day", "Hour", "Minute"] + column_names,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# .replace causes RecursionError in 1.5.* versions of pandas and so use
|
|
31
|
+
# .where instead.
|
|
32
|
+
pgdf = pgdf.where(pgdf != -1e30, pd.NA).dropna(how="all", subset=column_names)
|
|
33
|
+
|
|
34
|
+
# Can't let read_fwf parse dates because HSPF can use 24:00 for midnight of
|
|
35
|
+
# the following day, where pandas can't work with that. So we create
|
|
36
|
+
# manually here by creating an HH:MM delta and adding to the date.
|
|
37
|
+
pgdf["delta"] = pd.to_timedelta(
|
|
38
|
+
pgdf["Hour"].astype(int), unit="h"
|
|
39
|
+
) + pd.to_timedelta(pgdf["Minute"].astype(int), unit="m")
|
|
40
|
+
pgdf["Datetime"] = pd.to_datetime(pgdf[["Year", "Month", "Day"]]) + pgdf["delta"]
|
|
41
|
+
|
|
42
|
+
pgdf = pgdf.drop(columns=["Year", "Month", "Day", "Hour", "Minute", "delta"])
|
|
43
|
+
pgdf = pgdf.set_index(["Datetime"])
|
|
44
|
+
|
|
45
|
+
return pgdf
|
|
@@ -52,6 +52,99 @@ def pandas_offset_by_version(new_offset: str) -> str:
|
|
|
52
52
|
"""
|
|
53
53
|
Convert the time offset code to match the version of pandas.
|
|
54
54
|
|
|
55
|
+
+------------------------+--------+---------+-----------------------------+
|
|
56
|
+
| DateOffset | less | greater | Generic offset class, |
|
|
57
|
+
| | 2.2 | equal | defaults to absolute 24 |
|
|
58
|
+
| | | 2.2 | hours |
|
|
59
|
+
+========================+========+=========+=============================+
|
|
60
|
+
| BDay or BusinessDay | 'B' | 'B' | business day (weekday) |
|
|
61
|
+
+------------------------+--------+---------+-----------------------------+
|
|
62
|
+
| CDay or | 'C' | 'C' | custom business day |
|
|
63
|
+
| CustomBusinessDay | | | |
|
|
64
|
+
+------------------------+--------+---------+-----------------------------+
|
|
65
|
+
| Week | 'W' | 'W' | one week, optionally |
|
|
66
|
+
| | | | anchored on a day of the |
|
|
67
|
+
| | | | week |
|
|
68
|
+
+------------------------+--------+---------+-----------------------------+
|
|
69
|
+
| WeekOfMonth | 'WOM' | 'WOM' | the x-th day of the y-th |
|
|
70
|
+
| | | | week of each month |
|
|
71
|
+
+------------------------+--------+---------+-----------------------------+
|
|
72
|
+
| LastWeekOfMonth | 'LWOM' | 'LWOM' | the x-th day of the last |
|
|
73
|
+
| | | | week of each month |
|
|
74
|
+
+------------------------+--------+---------+-----------------------------+
|
|
75
|
+
| MonthEnd | 'M' | 'ME' | calendar month end |
|
|
76
|
+
+------------------------+--------+---------+-----------------------------+
|
|
77
|
+
| MonthBegin | 'MS' | 'MS' | calendar month begin |
|
|
78
|
+
+------------------------+--------+---------+-----------------------------+
|
|
79
|
+
| BMonthEnd or | 'BM' | 'BME' | business month end |
|
|
80
|
+
| BusinessMonthEnd | | | |
|
|
81
|
+
+------------------------+--------+---------+-----------------------------+
|
|
82
|
+
| BMonthBegin or | 'BMS' | 'BMS' | business month begin |
|
|
83
|
+
| BusinessMonthBegin | | | |
|
|
84
|
+
+------------------------+--------+---------+-----------------------------+
|
|
85
|
+
| CBMonthEnd or | 'CBM' | 'CBME' | custom business month end |
|
|
86
|
+
| CustomBusinessMonthEnd | | | |
|
|
87
|
+
+------------------------+--------+---------+-----------------------------+
|
|
88
|
+
| CBMonthBegin or | 'CBMS' | 'CBMS' | custom business month begin |
|
|
89
|
+
| CustomBusinessMonthBeg | | | |
|
|
90
|
+
| in | | | |
|
|
91
|
+
+------------------------+--------+---------+-----------------------------+
|
|
92
|
+
| SemiMonthEnd | 'SM' | 'SME' | 15th (or other |
|
|
93
|
+
| | | | day_of_month) and calendar |
|
|
94
|
+
| | | | month end |
|
|
95
|
+
+------------------------+--------+---------+-----------------------------+
|
|
96
|
+
| SemiMonthBegin | 'SMS' | 'SMS' | 15th (or other |
|
|
97
|
+
| | | | day_of_month) and calendar |
|
|
98
|
+
| | | | month begin |
|
|
99
|
+
+------------------------+--------+---------+-----------------------------+
|
|
100
|
+
| QuarterEnd | 'Q' | 'QE' | calendar quarter end |
|
|
101
|
+
+------------------------+--------+---------+-----------------------------+
|
|
102
|
+
| QuarterBegin | 'QS' | 'QS' | calendar quarter begin |
|
|
103
|
+
+------------------------+--------+---------+-----------------------------+
|
|
104
|
+
| BQuarterEnd | 'BQ | 'BQE' | business quarter end |
|
|
105
|
+
+------------------------+--------+---------+-----------------------------+
|
|
106
|
+
| BQuarterBegin | 'BQS' | 'BQS' | business quarter begin |
|
|
107
|
+
+------------------------+--------+---------+-----------------------------+
|
|
108
|
+
| FY5253Quarter | 'REQ' | 'REQ' | retail (aka 52-53 week) |
|
|
109
|
+
| | | | quarter |
|
|
110
|
+
+------------------------+--------+---------+-----------------------------+
|
|
111
|
+
| YearEnd | 'A' | 'YE' | calendar year end |
|
|
112
|
+
+------------------------+--------+---------+-----------------------------+
|
|
113
|
+
| YearBegin | 'AS' | 'YS' or | calendar year begin |
|
|
114
|
+
| | or | 'BYS' | |
|
|
115
|
+
| | 'BYS' | | |
|
|
116
|
+
+------------------------+--------+---------+-----------------------------+
|
|
117
|
+
| BYearEnd | 'BA' | 'BYE' | business year end |
|
|
118
|
+
+------------------------+--------+---------+-----------------------------+
|
|
119
|
+
| BYearBegin | 'BAS' | 'BYS' | business year begin |
|
|
120
|
+
+------------------------+--------+---------+-----------------------------+
|
|
121
|
+
| FY5253 | 'RE' | 'RE' | retail (aka 52-53 week) |
|
|
122
|
+
| | | | year |
|
|
123
|
+
+------------------------+--------+---------+-----------------------------+
|
|
124
|
+
| Easter | None | | Easter holiday |
|
|
125
|
+
+------------------------+--------+---------+-----------------------------+
|
|
126
|
+
| BusinessHour | 'BH' | 'bh' | business hour |
|
|
127
|
+
+------------------------+--------+---------+-----------------------------+
|
|
128
|
+
| CustomBusinessHour | 'CBH' | 'cbh' | custom business hour |
|
|
129
|
+
+------------------------+--------+---------+-----------------------------+
|
|
130
|
+
| Day | 'D' | 'D' | one absolute day |
|
|
131
|
+
+------------------------+--------+---------+-----------------------------+
|
|
132
|
+
| Hour | 'H' | 'h' | one hour |
|
|
133
|
+
+------------------------+--------+---------+-----------------------------+
|
|
134
|
+
| Minute | 'T' or | 'min' | one minute |
|
|
135
|
+
| | 'min' | | |
|
|
136
|
+
+------------------------+--------+---------+-----------------------------+
|
|
137
|
+
| Second | 'S' | 's' | one second |
|
|
138
|
+
+------------------------+--------+---------+-----------------------------+
|
|
139
|
+
| Milli | 'L' or | 'ms' | one millisecond |
|
|
140
|
+
| | 'ms' | | |
|
|
141
|
+
+------------------------+--------+---------+-----------------------------+
|
|
142
|
+
| Micro | 'U' or | 'us' | one microsecond |
|
|
143
|
+
| | 'us' | | |
|
|
144
|
+
+------------------------+--------+---------+-----------------------------+
|
|
145
|
+
| Nano | 'N' | 'ns' | one nanosecond |
|
|
146
|
+
+------------------------+--------+---------+-----------------------------+
|
|
147
|
+
|
|
55
148
|
Parameters
|
|
56
149
|
----------
|
|
57
150
|
offset
|
|
@@ -66,17 +159,43 @@ def pandas_offset_by_version(new_offset: str) -> str:
|
|
|
66
159
|
major, minor = pd.__version__.split(".")[:2]
|
|
67
160
|
if (int(major) + int(minor) / 10) < 2.2:
|
|
68
161
|
new_to_old_freq = {
|
|
69
|
-
"Y": "A",
|
|
70
162
|
"ME": "M",
|
|
71
163
|
"BME": "BM",
|
|
72
|
-
"SME": "SM",
|
|
73
164
|
"CBME": "CBM",
|
|
165
|
+
"SME": "SM",
|
|
74
166
|
"QE": "Q",
|
|
167
|
+
"QE-JAN": "Q-JAN",
|
|
168
|
+
"QE-FEB": "Q-FEB",
|
|
169
|
+
"QE-MAR": "Q-MAR",
|
|
170
|
+
"QE-APR": "Q-APR",
|
|
171
|
+
"QE-MAY": "Q-MAY",
|
|
172
|
+
"QE-JUN": "Q-JUN",
|
|
173
|
+
"QE-JUL": "Q-JUL",
|
|
174
|
+
"QE-AUG": "Q-AUG",
|
|
175
|
+
"QE-SEP": "Q-SEP",
|
|
176
|
+
"QE-OCT": "Q-OCT",
|
|
177
|
+
"QE-NOV": "Q-NOV",
|
|
178
|
+
"QE-DEC": "Q-DEC",
|
|
75
179
|
"BQE": "BQ",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
180
|
+
"BQE-JAN": "BQ-JAN",
|
|
181
|
+
"BQE-FEB": "BQ-FEB",
|
|
182
|
+
"BQE-MAR": "BQ-MAR",
|
|
183
|
+
"BQE-APR": "BQ-APR",
|
|
184
|
+
"BQE-MAY": "BQ-MAY",
|
|
185
|
+
"BQE-JUN": "BQ-JUN",
|
|
186
|
+
"BQE-JUL": "BQ-JUL",
|
|
187
|
+
"BQE-AUG": "BQ-AUG",
|
|
188
|
+
"BQE-SEP": "BQ-SEP",
|
|
189
|
+
"BQE-OCT": "BQ-OCT",
|
|
190
|
+
"BQE-NOV": "BQ-NOV",
|
|
191
|
+
"BQE-DEC": "BQ-DEC",
|
|
192
|
+
"YE": "A",
|
|
193
|
+
"YS": "AS",
|
|
194
|
+
"BYE": "BA",
|
|
195
|
+
"BYS": "BAS",
|
|
78
196
|
"bh": "BH",
|
|
79
197
|
"cbh": "CBH",
|
|
198
|
+
"h": "H",
|
|
80
199
|
"min": "T",
|
|
81
200
|
"s": "S",
|
|
82
201
|
"ms": "L",
|
|
@@ -1816,17 +1935,17 @@ def asbestfreq(data: DataFrame, force_freq: Optional[str] = None) -> DataFrame:
|
|
|
1816
1935
|
ndiff = sorted(set(ndiff))
|
|
1817
1936
|
ngcd = ndiff[0] if len(ndiff) == 1 else reduce(gcd, ndiff)
|
|
1818
1937
|
if ngcd < 1000:
|
|
1819
|
-
infer_freq = f"{ngcd}
|
|
1938
|
+
infer_freq = f"{ngcd}{pandas_offset_by_version('ns')}"
|
|
1820
1939
|
elif ngcd < 1000000:
|
|
1821
|
-
infer_freq = f"{ngcd // 1000}
|
|
1940
|
+
infer_freq = f"{ngcd // 1000}{pandas_offset_by_version('us')}"
|
|
1822
1941
|
elif ngcd < 1000000000:
|
|
1823
|
-
infer_freq = f"{ngcd // 1000000}
|
|
1942
|
+
infer_freq = f"{ngcd // 1000000}{pandas_offset_by_version('ms')}"
|
|
1824
1943
|
elif ngcd < 60000000000:
|
|
1825
|
-
infer_freq = f"{ngcd // 1000000000}
|
|
1944
|
+
infer_freq = f"{ngcd // 1000000000}{pandas_offset_by_version('s')}"
|
|
1826
1945
|
elif ngcd < 3600000000000:
|
|
1827
|
-
infer_freq = f"{ngcd // 60000000000}
|
|
1946
|
+
infer_freq = f"{ngcd // 60000000000}{pandas_offset_by_version('min')}"
|
|
1828
1947
|
elif ngcd < 86400000000000:
|
|
1829
|
-
infer_freq = f"{ngcd // 3600000000000}
|
|
1948
|
+
infer_freq = f"{ngcd // 3600000000000}{pandas_offset_by_version('h')}"
|
|
1830
1949
|
elif ngcd < 604800000000000:
|
|
1831
1950
|
infer_freq = f"{ngcd // 86400000000000}D"
|
|
1832
1951
|
elif ngcd < 2419200000000000:
|
|
@@ -2556,7 +2675,7 @@ def read_iso_ts(
|
|
|
2556
2675
|
|
|
2557
2676
|
if len(lresult_list) > 1:
|
|
2558
2677
|
epoch = pd.to_datetime("2000-01-01")
|
|
2559
|
-
moffset = epoch + to_offset("
|
|
2678
|
+
moffset = epoch + to_offset(pandas_offset_by_version("YE"))
|
|
2560
2679
|
offset_set = set()
|
|
2561
2680
|
|
|
2562
2681
|
for res in lresult_list:
|