AnomalyLab 0.2.1__tar.gz → 0.2.3__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.
Files changed (48) hide show
  1. {anomalylab-0.2.1 → anomalylab-0.2.3}/.gitignore +3 -0
  2. {anomalylab-0.2.1 → anomalylab-0.2.3/AnomalyLab.egg-info}/PKG-INFO +1 -1
  3. {anomalylab-0.2.1/AnomalyLab.egg-info → anomalylab-0.2.3}/PKG-INFO +1 -1
  4. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/empirical/portfolio.py +3 -3
  5. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/preprocess/outliers.py +0 -2
  6. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/preprocess/shift.py +11 -4
  7. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/structure/panel_data.py +0 -3
  8. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/structure/time_series.py +0 -3
  9. {anomalylab-0.2.1 → anomalylab-0.2.3}/setup.py +1 -1
  10. {anomalylab-0.2.1 → anomalylab-0.2.3}/.gitattributes +0 -0
  11. {anomalylab-0.2.1 → anomalylab-0.2.3}/.github/workflows/python-publish.yml +0 -0
  12. {anomalylab-0.2.1 → anomalylab-0.2.3}/AnomalyLab.egg-info/SOURCES.txt +0 -0
  13. {anomalylab-0.2.1 → anomalylab-0.2.3}/AnomalyLab.egg-info/dependency_links.txt +0 -0
  14. {anomalylab-0.2.1 → anomalylab-0.2.3}/AnomalyLab.egg-info/requires.txt +0 -0
  15. {anomalylab-0.2.1 → anomalylab-0.2.3}/AnomalyLab.egg-info/top_level.txt +0 -0
  16. {anomalylab-0.2.1 → anomalylab-0.2.3}/LICENSE +0 -0
  17. {anomalylab-0.2.1 → anomalylab-0.2.3}/MANIFEST.in +0 -0
  18. {anomalylab-0.2.1 → anomalylab-0.2.3}/README.md +0 -0
  19. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/__init__.py +0 -0
  20. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/config.py +0 -0
  21. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/core/__init__.py +0 -0
  22. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/core/core.py +0 -0
  23. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/datasets/__init__.py +0 -0
  24. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/datasets/dataset.py +0 -0
  25. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/datasets/panel_data.csv +0 -0
  26. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/datasets/time_series_data.csv +0 -0
  27. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/datasets/transition_matrix.png +0 -0
  28. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/empirical/__init__.py +0 -0
  29. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/empirical/correlation.py +0 -0
  30. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/empirical/empirical.py +0 -0
  31. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/empirical/fm_regression.py +0 -0
  32. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/empirical/persistence.py +0 -0
  33. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/empirical/summary.py +0 -0
  34. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/preprocess/__init__.py +0 -0
  35. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/preprocess/fillna.py +0 -0
  36. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/preprocess/normalize.py +0 -0
  37. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/preprocess/preprocessor.py +0 -0
  38. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/preprocess/truncate.py +0 -0
  39. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/structure/__init__.py +0 -0
  40. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/structure/data.py +0 -0
  41. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/utils/__init__.py +0 -0
  42. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/utils/imports.py +0 -0
  43. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/utils/utils.py +0 -0
  44. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/visualization/__init__.py +0 -0
  45. {anomalylab-0.2.1 → anomalylab-0.2.3}/anomalylab/visualization/format.py +0 -0
  46. {anomalylab-0.2.1 → anomalylab-0.2.3}/requirements.txt +0 -0
  47. {anomalylab-0.2.1 → anomalylab-0.2.3}/setup.cfg +0 -0
  48. {anomalylab-0.2.1 → anomalylab-0.2.3}/tests/__init__.py +0 -0
@@ -1,3 +1,6 @@
1
+ # My ignorance
2
+ *.docx
3
+
1
4
  # Byte-compiled / optimized / DLL files
2
5
  __pycache__/
3
6
  *.py[cod]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AnomalyLab
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: A Python package for empirical asset pricing analysis.
5
5
  Author: FinPhd
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AnomalyLab
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: A Python package for empirical asset pricing analysis.
5
5
  Author: FinPhd
6
6
  Classifier: Programming Language :: Python :: 3
@@ -40,11 +40,11 @@ class PortfolioAnalysis(Empirical):
40
40
  for field in ["endog", "weight"]:
41
41
  if getattr(self, field) is None:
42
42
  raise ValueError(f"{field} must be provided")
43
- self.ft_series = self.factors_series.df
44
43
  if self.models is not None and self.factors_series is None:
45
44
  raise ValueError(
46
45
  "If 'models' is provided, 'factors_series' must also be provided!"
47
46
  )
47
+ self.ft_series = getattr(self.factors_series, "df", None)
48
48
 
49
49
  def add_star(self, mean_val: float, p_val: float) -> str:
50
50
  """Add significance stars to mean values based on p-value thresholds.
@@ -677,8 +677,8 @@ if __name__ == "__main__":
677
677
  panel,
678
678
  endog="return",
679
679
  weight="MktCap",
680
- models=Models,
681
- factors_series=time_series,
680
+ # models=Models,
681
+ # factors_series=time_series,
682
682
  )
683
683
 
684
684
  group = portfolio.GroupN("Illiq", 10)
@@ -126,8 +126,6 @@ class OutlierHandler(Preprocessor):
126
126
  panel_data (PanelData): The panel data object containing the data to be processed.
127
127
  """
128
128
 
129
- panel_data: PanelData
130
-
131
129
  def winsorize(
132
130
  self,
133
131
  columns: Columns = None,
@@ -56,8 +56,15 @@ class Shift(Preprocessor):
56
56
  Shift: The instance of the Shift class with updated state.
57
57
 
58
58
  Raises:
59
- ValueError: If the data has already been shifted.
59
+ NotImplementedError: Only monthly frequency is supported.
60
+ warnings: The data has already been shifted.
61
+
60
62
  """
63
+
64
+ # todo: add support for daily and yearly frequency
65
+ if self.panel_data.frequency != "M":
66
+ raise NotImplementedError("Only monthly frequency is supported.")
67
+
61
68
  # Check if the data has already been shifted
62
69
  if self.panel_data.shift:
63
70
  # raise ValueError("The data has already been shifted.")
@@ -76,14 +83,14 @@ class Shift(Preprocessor):
76
83
  ):
77
84
  # Copy the columns to shift
78
85
  df_shift: DataFrame = self.panel_data.df[
79
- [self.panel_data.time, self.panel_data.id] + columns
86
+ [self.time, self.id] + columns
80
87
  ].copy()
81
88
  # Shift the columns
82
- df_shift[self.panel_data.time] += period
89
+ df_shift[self.time] += period
83
90
  # Merge the shifted columns
84
91
  self.panel_data.df = self.panel_data.df.merge(
85
92
  right=df_shift,
86
- on=[self.panel_data.time, self.panel_data.id],
93
+ on=[self.time, self.id],
87
94
  # If dropna is True, only keep the rows with matching 'time' and 'id'
88
95
  how="inner" if dropna else "left",
89
96
  suffixes=("", f"({period})"),
@@ -58,9 +58,6 @@ class PanelData(Data):
58
58
  This method identifies remaining columns as firm characteristics, excluding classifications.
59
59
  """
60
60
  self.df[self.id] = self.df[self.id].astype(int)
61
- # todo: add support for daily and yearly frequency
62
- if self.frequency != "M":
63
- raise NotImplementedError("Only monthly frequency is supported.")
64
61
  self.df[self.time] = pd.to_datetime(self.df[self.time], format="ISO8601")
65
62
  self.df[self.time] = self.df[self.time].dt.to_period(freq=self.frequency)
66
63
  self.df = self.df.sort_values(by=[self.time, self.id])
@@ -34,9 +34,6 @@ class TimeSeries(Data):
34
34
 
35
35
  This method renames the time column to a standardized name and identifies remaining columns as factors.
36
36
  """
37
- # todo: add support for daily and yearly frequency
38
- if self.frequency != "M":
39
- raise NotImplementedError("Only monthly frequency is supported.")
40
37
  self.df[self.time] = pd.to_datetime(self.df[self.time], format="ISO8601")
41
38
  self.df[self.time] = self.df[self.time].dt.to_period(freq=self.frequency)
42
39
  self.df = self.df.sort_values(by=self.time)
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name="AnomalyLab",
5
- version="0.2.1",
5
+ version="0.2.3",
6
6
  author="FinPhd",
7
7
  # author_email="your.email@example.com",
8
8
  description="A Python package for empirical asset pricing analysis.",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes