spotforecast2 0.2.1__tar.gz → 0.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.
Files changed (47) hide show
  1. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/PKG-INFO +1 -1
  2. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/pyproject.toml +1 -1
  3. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/data/fetch_data.py +23 -13
  4. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/processing/n2n_predict.py +1 -1
  5. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/processing/n2n_predict_with_covariates.py +1 -1
  6. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/README.md +0 -0
  7. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/__init__.py +0 -0
  8. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/data/__init__.py +0 -0
  9. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/data/data.py +0 -0
  10. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/exceptions.py +0 -0
  11. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/forecaster/__init__.py +0 -0
  12. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/forecaster/base.py +0 -0
  13. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/forecaster/metrics.py +0 -0
  14. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/forecaster/recursive/__init__.py +0 -0
  15. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/forecaster/recursive/_forecaster_equivalent_date.py +0 -0
  16. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/forecaster/recursive/_forecaster_recursive.py +0 -0
  17. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/forecaster/recursive/_warnings.py +0 -0
  18. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/forecaster/utils.py +0 -0
  19. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/__init__.py +0 -0
  20. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/bayesian_search.py +0 -0
  21. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/grid_search.py +0 -0
  22. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/random_search.py +0 -0
  23. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/split_base.py +0 -0
  24. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/split_one_step.py +0 -0
  25. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/split_ts_cv.py +0 -0
  26. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/utils_common.py +0 -0
  27. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/utils_metrics.py +0 -0
  28. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/model_selection/validation.py +0 -0
  29. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/preprocessing/__init__.py +0 -0
  30. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/preprocessing/_binner.py +0 -0
  31. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/preprocessing/_common.py +0 -0
  32. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/preprocessing/_differentiator.py +0 -0
  33. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/preprocessing/_rolling.py +0 -0
  34. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/preprocessing/curate_data.py +0 -0
  35. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/preprocessing/imputation.py +0 -0
  36. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/preprocessing/outlier.py +0 -0
  37. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/preprocessing/split.py +0 -0
  38. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/processing/agg_predict.py +0 -0
  39. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/py.typed +0 -0
  40. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/utils/__init__.py +0 -0
  41. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/utils/convert_to_utc.py +0 -0
  42. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/utils/data_transform.py +0 -0
  43. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/utils/forecaster_config.py +0 -0
  44. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/utils/generate_holiday.py +0 -0
  45. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/utils/validation.py +0 -0
  46. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/weather/__init__.py +0 -0
  47. {spotforecast2-0.2.1 → spotforecast2-0.2.2}/src/spotforecast2/weather/weather_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spotforecast2
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Forecasting with spot
5
5
  Author: bartzbeielstein
6
6
  Author-email: bartzbeielstein <32470350+bartzbeielstein@users.noreply.github.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spotforecast2"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "Forecasting with spot"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -44,7 +44,8 @@ def get_data_home(data_home: Optional[Union[str, Path]] = None) -> Path:
44
44
 
45
45
 
46
46
  def fetch_data(
47
- filename: Union[str, pd.DataFrame] = "data_in.csv",
47
+ filename: Optional[str] = None,
48
+ dataframe: Optional[pd.DataFrame] = None,
48
49
  columns: Optional[list] = None,
49
50
  index_col: int = 0,
50
51
  parse_dates: bool = True,
@@ -54,13 +55,15 @@ def fetch_data(
54
55
  """Fetches the integrated raw dataset from a CSV file or processes a DataFrame.
55
56
 
56
57
  Args:
57
- filename (str or pd.DataFrame):
58
- Filename of the CSV file containing the dataset (located in data home directory)
59
- or a pandas DataFrame. If DataFrame is provided, it will be processed with
60
- proper timezone handling. Default: "data_in.csv".
58
+ filename (str, optional):
59
+ Filename of the CSV file containing the dataset. Must be located in the
60
+ data home directory. If both filename and dataframe are None, defaults to "data_in.csv".
61
+ dataframe (pd.DataFrame, optional):
62
+ A pandas DataFrame to process. If provided, it will be processed with
63
+ proper timezone handling. Mutually exclusive with filename.
61
64
  columns (list, optional):
62
65
  List of columns to be included in the dataset. If None, all columns are included.
63
- If an empty list is provided, a ValueError is blocked.
66
+ If an empty list is provided, a ValueError is raised.
64
67
  index_col (int):
65
68
  Column index to be used as the index (only used when loading from CSV).
66
69
  parse_dates (bool):
@@ -75,37 +78,44 @@ def fetch_data(
75
78
  pd.DataFrame: The integrated raw dataset with UTC timezone.
76
79
 
77
80
  Raises:
78
- ValueError: If columns is an empty list.
81
+ ValueError: If columns is an empty list or if both filename and dataframe are provided.
79
82
  FileNotFoundError: If CSV file does not exist.
80
83
 
81
84
  Examples:
82
- Load from CSV:
85
+ Load from CSV (default):
83
86
  >>> from spotforecast2.data.fetch_data import fetch_data
84
87
  >>> data = fetch_data(columns=["col1", "col2"])
85
88
  >>> data.head()
86
89
  Header1 Header2 Header3
87
90
 
91
+ Load from specific CSV:
92
+ >>> data = fetch_data(filename="custom_data.csv")
93
+
88
94
  Process a DataFrame:
89
95
  >>> import pandas as pd
90
96
  >>> df = pd.DataFrame({"value": [1, 2, 3]},
91
97
  ... index=pd.date_range("2024-01-01", periods=3, freq="h"))
92
- >>> data = fetch_data(filename=df, timezone="Europe/Berlin")
98
+ >>> data = fetch_data(dataframe=df, timezone="Europe/Berlin")
93
99
  >>> data.index.tz
94
100
  <UTC>
95
101
  """
96
102
  if columns is not None and len(columns) == 0:
97
103
  raise ValueError("columns must be specified and cannot be empty.")
104
+
105
+ if filename is not None and dataframe is not None:
106
+ raise ValueError("Cannot specify both filename and dataframe. Please provide only one.")
98
107
 
99
- # Check if filename is actually a DataFrame
100
- if isinstance(filename, pd.DataFrame):
101
- # Use Data.from_dataframe for proper timezone handling
108
+ # Process DataFrame if provided
109
+ if dataframe is not None:
102
110
  dataset = Data.from_dataframe(
103
- df=filename,
111
+ df=dataframe,
104
112
  timezone=timezone,
105
113
  columns=columns,
106
114
  )
107
115
  else:
108
116
  # Load from CSV file
117
+ if filename is None:
118
+ filename = "data_in.csv"
109
119
  csv_path = get_data_home() / filename
110
120
  if not Path(csv_path).is_file():
111
121
  raise FileNotFoundError(f"The file {csv_path} does not exist.")
@@ -319,7 +319,7 @@ def n2n_predict(
319
319
  if data is not None:
320
320
  if verbose:
321
321
  print("Using provided dataframe...")
322
- data = fetch_data(filename=data, columns=TARGET)
322
+ data = fetch_data(dataframe=data, columns=TARGET)
323
323
  else:
324
324
  if verbose:
325
325
  print("Fetching data from CSV...")
@@ -876,7 +876,7 @@ def n2n_predict_with_covariates(
876
876
  else:
877
877
  if verbose:
878
878
  print(" Using provided dataframe...")
879
- data = fetch_data(filename=data, timezone=timezone)
879
+ data = fetch_data(dataframe=data, timezone=timezone)
880
880
 
881
881
  target_columns = data.columns.tolist()
882
882
 
File without changes