PythonTsa 1.4.7__py3-none-any.whl → 1.4.9__py3-none-any.whl

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.

Potentially problematic release.


This version of PythonTsa might be problematic. Click here for more details.

@@ -8,10 +8,10 @@ import numpy as np
8
8
  import pandas as pd
9
9
  import requests
10
10
 
11
- def create_evaluation_df(predictions, test_inputs, H, scaler):
11
+ def create_evaluation_df(predictions, test_inputs, h, scaler):
12
12
  """Create a data frame for easy evaluation"""
13
13
  eval_df = pd.DataFrame(
14
- predictions, columns=["t+" + str(t) for t in range(1, H + 1)]
14
+ predictions, columns=["t+" + str(t) for t in range(1, h + 1)]
15
15
  )
16
16
  eval_df["timestamp"] = test_inputs.dataframe.index
17
17
  eval_df = pd.melt(
@@ -24,7 +24,7 @@ def create_evaluation_df(predictions, test_inputs, H, scaler):
24
24
  return eval_df
25
25
 
26
26
 
27
- class TimeSeriesTensor(UserDict):
27
+ class tstensor(UserDict):
28
28
  """A dictionary of tensors for input into the RNN model.
29
29
 
30
30
  Use this class to:
@@ -47,7 +47,7 @@ class TimeSeriesTensor(UserDict):
47
47
  """
48
48
 
49
49
  def __init__(
50
- self, dataset, target, H, tensor_structure, freq="H", drop_incomplete=True
50
+ self, dataset, target, h, tensor_structure, freq="h", drop_incomplete=True
51
51
  ):
52
52
  self.dataset = dataset
53
53
  self.target = target
@@ -57,7 +57,7 @@ class TimeSeriesTensor(UserDict):
57
57
  self.dataframe = self._shift_data(H, freq, drop_incomplete)
58
58
  self.data = self._df2tensors(self.dataframe)
59
59
 
60
- def _shift_data(self, H, freq, drop_incomplete):
60
+ def _shift_data(self, h, freq, drop_incomplete):
61
61
 
62
62
  # Use the tensor_structures definitions to shift the features in the original dataset.
63
63
  # The result is a Pandas dataframe with multi-index columns in the hierarchy
@@ -68,7 +68,7 @@ class TimeSeriesTensor(UserDict):
68
68
  df = self.dataset.copy()
69
69
 
70
70
  idx_tuples = []
71
- for t in range(1, H + 1):
71
+ for t in range(1, h + 1):
72
72
  df["t+" + str(t)] = df[self.target].shift(t * -1, freq=freq)
73
73
  idx_tuples.append(("target", "y", "t+" + str(t)))
74
74
 
@@ -103,26 +103,27 @@ class TimeSeriesTensor(UserDict):
103
103
 
104
104
  return df
105
105
 
106
- def _df2tensors(self, dataframe):
106
+ def _df2tensors(self, dataframe):
107
107
 
108
- inputs = {}
109
- y = dataframe["target"]
110
- y = y.to_numpy()
111
- inputs["target"] = y
108
+ inputs = {}
109
+ y = dataframe["target"]
110
+ y = y.to_numpy()
111
+ inputs["target"] = y
112
112
 
113
- for name, structure in self.tensor_structure.items():
114
- rng = structure[0]
115
- cols = structure[1]
116
- tensor = dataframe[name][cols].to_numpy()
117
- if rng is None:
118
- tensor = tensor.reshape(tensor.shape[0], len(cols))
119
- else:
120
- tensor = tensor.reshape(tensor.shape[0], len(cols), len(rng))
121
- tensor = np.transpose(tensor, axes=[0, 2, 1])
122
- inputs[name] = tensor
113
+ for name, structure in self.tensor_structure.items():
114
+ rng = structure[0]
115
+ cols = structure[1]
116
+ tensor = dataframe[name][cols].to_numpy()
117
+ if rng is None:
118
+ tensor = tensor.reshape(tensor.shape[0], len(cols))
119
+ else:
120
+ tensor = tensor.reshape(tensor.shape[0], len(cols), len(rng))
121
+ tensor = np.transpose(tensor, axes=[0, 2, 1])
122
+ inputs[name] = tensor
123
123
 
124
- return inputs
124
+ return inputs
125
125
 
126
- def subset_data(self, new_dataframe):
126
+ def subset_data(self, new_dataframe):
127
127
 
128
- self.dataframe = new_dataframe
128
+ self.dataframe = new_dataframe
129
+ self.data = self._df2tensors(self.dataframe)
PythonTsa/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.4.7"
1
+ __version__ = "1.4.8"
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: PythonTsa
3
- Version: 1.4.7
3
+ Version: 1.4.9
4
4
  Summary: Package for Applied Time Series Analysis and Forecasting with Python, Springer 2022
5
5
  Author: Changquan Huang
6
6
  Author-email: h.changquan@icloud.com
@@ -9,6 +9,13 @@ Classifier: License :: OSI Approved :: MIT License
9
9
  Classifier: Operating System :: OS Independent
10
10
  Requires-Python: >=3.6
11
11
  Description-Content-Type: text/markdown
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: classifier
15
+ Dynamic: description
16
+ Dynamic: description-content-type
17
+ Dynamic: requires-python
18
+ Dynamic: summary
12
19
 
13
20
  This package is a companion to the book Applied Time Series Analysis and Forecasting with Python, Springer 2022. It contains several
14
21
  important Python functions for analyzing time series and most data sets analyzed in the book. Naturally, these functions can also be used to analyze other time series data.
@@ -9,8 +9,8 @@ PythonTsa/Selecting_arma.py,sha256=wuhYx8oWpaBQ2bRbpzFq6d6ZlaB-LY7ckMERrprqftE,3
9
9
  PythonTsa/Selecting_arma2.py,sha256=x33yavKr5jE3nBoF8LhSWXoj-lM6_OvsIiqoS-k5qNA,3472
10
10
  PythonTsa/SimulSBM.py,sha256=hOkp5RaAepGiSKxEi0b_ttcN3pE0qQYcIYS20SWb_F8,696
11
11
  PythonTsa/True_acf.py,sha256=mH3WVoCSOF_8FeCw9ZVbak0VMmYR7RnwrWGAaCUm5zw,1266
12
- PythonTsa/Utils.py,sha256=V3fVW7GYh5Nf3MKfSVzp7MePwUj5l_pChzxT6OY6LBo,4977
13
- PythonTsa/__init__.py,sha256=J_NywHoSHyIte5hglrEd6NCRzwecLOYNvbQbgoiBa2A,23
12
+ PythonTsa/TsTensor.py,sha256=EIBISKBf2VPY93iLjIeejIp4yW3j0ix23x3Zu7r4DEQ,4951
13
+ PythonTsa/__init__.py,sha256=E4mzTBdhfF_J-eYfpxL9p266GOT21FVqqvr6DARJwNo,23
14
14
  PythonTsa/datadir.py,sha256=joAY91FulKj62XPM57OiLKF9Zp26Xjy_N3Yqu0YN0q0,344
15
15
  PythonTsa/plot_acf_pacf.py,sha256=K4eW8tFea2M9Ztm39uJqPgubQs_j0BwHg-aYITOaNvs,1762
16
16
  PythonTsa/plot_multi_ACF.py,sha256=P-clInPKu4VouCx72YOHtRiDeVX8S4oULG3VYx1WovM,2407
@@ -52,7 +52,7 @@ PythonTsa/Ptsadata/realGdpConsInv.csv,sha256=IxKMRypOpBlnTPzgI9ITMJxVAJ32y5auKTC
52
52
  PythonTsa/Ptsadata/us-q-rgdp.csv,sha256=NL30qZ5lkdIR3HLhqZbwh9yxzHO1E21t6nf0uVgH4zA,6055
53
53
  PythonTsa/Ptsadata/usFOI.csv,sha256=byZRSPnk599eqWnuo-2lONvO_nnLE-z2J9KyaG_Kn-w,8492
54
54
  PythonTsa/Ptsadata/usGDPnotAdjust.csv,sha256=LVX8mmEDZoQ35dHSgG0L6NchXFUu9LO770nUiKRljwg,6114
55
- PythonTsa-1.4.7.dist-info/METADATA,sha256=66CpdVbP12ZbSXD6ky7OMTDCMkePAwrOifKH3PNsEBM,740
56
- PythonTsa-1.4.7.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
57
- PythonTsa-1.4.7.dist-info/top_level.txt,sha256=iCSWYaQTwlSCwrOInjSrMBYGOGlyU8KHW3el0-Kq1Xs,10
58
- PythonTsa-1.4.7.dist-info/RECORD,,
55
+ pythontsa-1.4.9.dist-info/METADATA,sha256=nbxq9oqu71Rxm0sKGtohUuxXewhfOJp2R8gak9gfPwg,902
56
+ pythontsa-1.4.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
57
+ pythontsa-1.4.9.dist-info/top_level.txt,sha256=iCSWYaQTwlSCwrOInjSrMBYGOGlyU8KHW3el0-Kq1Xs,10
58
+ pythontsa-1.4.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.3)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5