direl-ts-tool-kit 0.3.0__tar.gz → 0.3.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.
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/PKG-INFO +1 -1
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit/plot/plot_ts.py +4 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit/utilities/data_prep.py +14 -7
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit.egg-info/PKG-INFO +1 -1
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/setup.py +1 -1
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/LICENCE +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/README.md +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit/__init__.py +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit/plot/__init__.py +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit/plot/plot_style.py +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit/utilities/__init__.py +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit.egg-info/SOURCES.txt +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit.egg-info/dependency_links.txt +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit.egg-info/requires.txt +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit.egg-info/top_level.txt +0 -0
- {direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/setup.cfg +0 -0
|
@@ -100,6 +100,10 @@ def plot_time_series(
|
|
|
100
100
|
if time_unit == "Day":
|
|
101
101
|
ax.xaxis.set_major_locator(mdates.DayLocator())
|
|
102
102
|
ax.xaxis.set_minor_locator(mdates.HourLocator())
|
|
103
|
+
|
|
104
|
+
if time_unit == "Hour":
|
|
105
|
+
ax.xaxis.set_major_locator(mdates.HourLocator())
|
|
106
|
+
ax.xaxis.set_minor_locator(mdates.MinuteLocator())
|
|
103
107
|
|
|
104
108
|
ax.tick_params(axis="x", rotation=rot)
|
|
105
109
|
ax.grid(which="both")
|
{direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit/utilities/data_prep.py
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import pandas as pd
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def parse_datetime_index(df_raw, date_column="date"):
|
|
4
|
+
def parse_datetime_index(df_raw, date_column="date", format=None):
|
|
5
5
|
"""
|
|
6
6
|
Parses a specified column into datetime objects and sets it as the DataFrame index.
|
|
7
7
|
|
|
8
|
-
This function
|
|
9
|
-
|
|
8
|
+
This function prepares raw data for time series analysis by ensuring the
|
|
9
|
+
DataFrame is indexed by the correct datetime type.
|
|
10
10
|
|
|
11
11
|
Parameters
|
|
12
12
|
----------
|
|
@@ -15,17 +15,24 @@ def parse_datetime_index(df_raw, date_column="date"):
|
|
|
15
15
|
date_column : str, optional
|
|
16
16
|
The name of the column in 'df_raw' that contains the date/time information.
|
|
17
17
|
Defaults to "date".
|
|
18
|
+
format : str, optional
|
|
19
|
+
The explicit format string (e.g., '%Y%m%d', '%Y-%m-%d %H:%M:%S')
|
|
20
|
+
to parse the dates, passed to `pd.to_datetime`. If None (default),
|
|
21
|
+
Pandas attempts to infer the format automatically.
|
|
18
22
|
|
|
19
23
|
Returns
|
|
20
24
|
-------
|
|
21
25
|
df_ts : pd.DataFrame
|
|
22
|
-
A copy of the original DataFrame with the specified date column removed
|
|
23
|
-
and set as the DatetimeIndex.
|
|
26
|
+
A copy of the original DataFrame with the specified date column removed
|
|
27
|
+
and set as the DatetimeIndex. The returned DataFrame is ready for
|
|
28
|
+
time series operations.
|
|
24
29
|
"""
|
|
30
|
+
if not format:
|
|
31
|
+
date_parsed = pd.to_datetime(df_raw[date_column])
|
|
32
|
+
else:
|
|
33
|
+
date_parsed = pd.to_datetime(df_raw[date_column], format=format)
|
|
25
34
|
|
|
26
|
-
date_parsed = pd.to_datetime(df_raw[date_column])
|
|
27
35
|
df_ts = df_raw.copy()
|
|
28
|
-
original_dates = df_raw[date_column]
|
|
29
36
|
df_ts.drop(columns=[date_column], inplace=True)
|
|
30
37
|
df_ts.set_index(date_parsed, inplace=True)
|
|
31
38
|
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="direl-ts-tool-kit",
|
|
5
|
-
version="0.3.
|
|
5
|
+
version="0.3.2",
|
|
6
6
|
description="A toolbox for time series analysis and visualization.",
|
|
7
7
|
long_description=open("README.md", encoding="utf-8").read(),
|
|
8
8
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{direl_ts_tool_kit-0.3.0 → direl_ts_tool_kit-0.3.2}/direl_ts_tool_kit.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|