AnomalyLab 0.2.8__tar.gz → 0.2.9__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 (49) hide show
  1. {anomalylab-0.2.8 → anomalylab-0.2.9/AnomalyLab.egg-info}/PKG-INFO +1 -1
  2. {anomalylab-0.2.8/AnomalyLab.egg-info → anomalylab-0.2.9}/PKG-INFO +1 -1
  3. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/core/core.py +7 -1
  4. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/empirical/portfolio.py +2 -0
  5. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/structure/data.py +3 -8
  6. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/structure/panel_data.py +2 -2
  7. {anomalylab-0.2.8 → anomalylab-0.2.9}/setup.py +1 -1
  8. {anomalylab-0.2.8 → anomalylab-0.2.9}/.gitattributes +0 -0
  9. {anomalylab-0.2.8 → anomalylab-0.2.9}/.github/workflows/python-publish.yml +0 -0
  10. {anomalylab-0.2.8 → anomalylab-0.2.9}/.gitignore +0 -0
  11. {anomalylab-0.2.8 → anomalylab-0.2.9}/AnomalyLab.egg-info/SOURCES.txt +0 -0
  12. {anomalylab-0.2.8 → anomalylab-0.2.9}/AnomalyLab.egg-info/dependency_links.txt +0 -0
  13. {anomalylab-0.2.8 → anomalylab-0.2.9}/AnomalyLab.egg-info/requires.txt +0 -0
  14. {anomalylab-0.2.8 → anomalylab-0.2.9}/AnomalyLab.egg-info/top_level.txt +0 -0
  15. {anomalylab-0.2.8 → anomalylab-0.2.9}/LICENSE +0 -0
  16. {anomalylab-0.2.8 → anomalylab-0.2.9}/MANIFEST.in +0 -0
  17. {anomalylab-0.2.8 → anomalylab-0.2.9}/README.md +0 -0
  18. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/__init__.py +0 -0
  19. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/config.py +0 -0
  20. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/core/__init__.py +0 -0
  21. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/datasets/__init__.py +0 -0
  22. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/datasets/dataset.py +0 -0
  23. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/datasets/panel_data.csv +0 -0
  24. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/datasets/time_series_data.csv +0 -0
  25. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/datasets/transition_matrix.png +0 -0
  26. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/empirical/__init__.py +0 -0
  27. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/empirical/correlation.py +0 -0
  28. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/empirical/empirical.py +0 -0
  29. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/empirical/factor_return.py +0 -0
  30. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/empirical/fm_regression.py +0 -0
  31. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/empirical/persistence.py +0 -0
  32. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/empirical/summary.py +0 -0
  33. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/preprocess/__init__.py +0 -0
  34. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/preprocess/fillna.py +0 -0
  35. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/preprocess/normalize.py +0 -0
  36. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/preprocess/outliers.py +0 -0
  37. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/preprocess/preprocessor.py +0 -0
  38. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/preprocess/shift.py +0 -0
  39. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/preprocess/truncate.py +0 -0
  40. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/structure/__init__.py +0 -0
  41. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/structure/time_series.py +0 -0
  42. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/utils/__init__.py +0 -0
  43. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/utils/imports.py +0 -0
  44. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/utils/utils.py +0 -0
  45. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/visualization/__init__.py +0 -0
  46. {anomalylab-0.2.8 → anomalylab-0.2.9}/anomalylab/visualization/format.py +0 -0
  47. {anomalylab-0.2.8 → anomalylab-0.2.9}/requirements.txt +0 -0
  48. {anomalylab-0.2.8 → anomalylab-0.2.9}/setup.cfg +0 -0
  49. {anomalylab-0.2.8 → anomalylab-0.2.9}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AnomalyLab
3
- Version: 0.2.8
3
+ Version: 0.2.9
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.8
3
+ Version: 0.2.9
4
4
  Summary: A Python package for empirical asset pricing analysis.
5
5
  Author: FinPhd
6
6
  Classifier: Programming Language :: Python :: 3
@@ -27,6 +27,7 @@ class Panel:
27
27
  ret: str = "return"
28
28
  classifications: Optional[list[str] | str] = None
29
29
  drop_all_chars_missing: bool = False
30
+ is_copy: bool = False
30
31
 
31
32
  def __post_init__(self) -> None:
32
33
  self.panel_data: PanelData = PanelData(
@@ -38,6 +39,7 @@ class Panel:
38
39
  ret=self.ret,
39
40
  classifications=self.classifications,
40
41
  drop_all_chars_missing=self.drop_all_chars_missing,
42
+ is_copy=self.is_copy,
41
43
  )
42
44
  self._normalize_processor = None
43
45
  self._fillna_processor = None
@@ -372,7 +374,11 @@ if __name__ == "__main__":
372
374
  }
373
375
 
374
376
  panel = Panel(
375
- df, name="Stocks", classifications="industry", drop_all_chars_missing=True
377
+ df,
378
+ name="Stocks",
379
+ classifications="industry",
380
+ drop_all_chars_missing=True,
381
+ is_copy=False,
376
382
  )
377
383
  time_series: TimeSeries = TimeSeries(df=ts, name="Factor Series")
378
384
  pp(panel)
@@ -280,6 +280,7 @@ class PortfolioAnalysis(Empirical):
280
280
  core_g (int): The group number for portfolio grouping of the core variable.
281
281
  format (bool): Whether to format the output for display. Defaults to False.
282
282
  decimal (Optional[int]): The number of decimal places for formatting. Defaults to None.
283
+ factor_return (bool): Whether to output factor returns in the analysis. Defaults to False.
283
284
 
284
285
  Returns:
285
286
  tuple: A tuple containing the equal-weighted and value-weighted results DataFrames.
@@ -443,6 +444,7 @@ class PortfolioAnalysis(Empirical):
443
444
  format (bool): Whether to format the output for display. Defaults to False.
444
445
  type (str): Type of grouping, can be 'dependent' or 'independent'. Defaults to 'dependent'.
445
446
  decimal (Optional[int]): The number of decimal places to round to. Defaults to None.
447
+ factor_return (bool): Whether to output factor returns in the analysis. Defaults to False.
446
448
 
447
449
  Returns:
448
450
  tuple: A tuple containing the equal-weighted and value-weighted results DataFrames.
@@ -13,6 +13,7 @@ class Data(ABC):
13
13
 
14
14
  df: DataFrame
15
15
  name: Optional[str] = None
16
+ is_copy: bool = False
16
17
 
17
18
  def __post_init__(self) -> None:
18
19
  """
@@ -21,18 +22,12 @@ class Data(ABC):
21
22
  1. Check if the columns are valid.
22
23
  2. Preprocess the data.
23
24
  3. Set the flag if needed.
24
- 4. Call the other_init method if needed.
25
25
  """
26
- if self.name is None:
27
- self.name = "anomaly"
26
+ if self.is_copy:
27
+ self.df = copy.deepcopy(self.df)
28
28
  self._check_columns()
29
29
  self._preprocess()
30
30
  self.set_flag()
31
- self.other_init()
32
-
33
- def other_init(self) -> None:
34
- """This method is a placeholder for additional initialization logic."""
35
- pass
36
31
 
37
32
  def set_flag(self) -> None:
38
33
  """This method is meant to be overridden by subclasses to set flags."""
@@ -20,7 +20,7 @@ class PanelData(Data):
20
20
  frequency (Literal["D", "M", "Y"]):
21
21
  The frequency of the data. Defaults to "M".
22
22
  ret (str):
23
- The column name for the excess return. Defaults to "return".
23
+ The column name for the excess return. Defaults to None.
24
24
  classifications (list[str]):
25
25
  The list of classification columns.
26
26
  drop_all_chars_missing (bool):
@@ -30,7 +30,7 @@ class PanelData(Data):
30
30
  id: str = "permno"
31
31
  time: str = "date"
32
32
  frequency: Literal["D", "M", "Y"] = "M"
33
- ret: str = "return"
33
+ ret: Optional[str] = None
34
34
  classifications: Optional[list[str] | str] = None
35
35
  drop_all_chars_missing: bool = False
36
36
 
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name="AnomalyLab",
5
- version="0.2.8",
5
+ version="0.2.9",
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
File without changes