gensor 0.2.3__tar.gz → 0.2.4__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 (33) hide show
  1. {gensor-0.2.3 → gensor-0.2.4}/PKG-INFO +1 -1
  2. {gensor-0.2.3 → gensor-0.2.4}/gensor/core/base.py +4 -1
  3. {gensor-0.2.3 → gensor-0.2.4}/gensor/core/dataset.py +5 -1
  4. {gensor-0.2.3 → gensor-0.2.4}/gensor/core/indexer.py +2 -2
  5. {gensor-0.2.3 → gensor-0.2.4}/pyproject.toml +1 -1
  6. {gensor-0.2.3 → gensor-0.2.4}/LICENSE +0 -0
  7. {gensor-0.2.3 → gensor-0.2.4}/README.md +0 -0
  8. {gensor-0.2.3 → gensor-0.2.4}/gensor/__init__.py +0 -0
  9. {gensor-0.2.3 → gensor-0.2.4}/gensor/analysis/__init__.py +0 -0
  10. {gensor-0.2.3 → gensor-0.2.4}/gensor/analysis/outliers.py +0 -0
  11. {gensor-0.2.3 → gensor-0.2.4}/gensor/analysis/stats.py +0 -0
  12. {gensor-0.2.3 → gensor-0.2.4}/gensor/config.py +0 -0
  13. {gensor-0.2.3 → gensor-0.2.4}/gensor/core/__init__.py +0 -0
  14. {gensor-0.2.3 → gensor-0.2.4}/gensor/core/timeseries.py +0 -0
  15. {gensor-0.2.3 → gensor-0.2.4}/gensor/db/__init__.py +0 -0
  16. {gensor-0.2.3 → gensor-0.2.4}/gensor/db/connection.py +0 -0
  17. {gensor-0.2.3 → gensor-0.2.4}/gensor/exceptions.py +0 -0
  18. {gensor-0.2.3 → gensor-0.2.4}/gensor/io/__init__.py +0 -0
  19. {gensor-0.2.3 → gensor-0.2.4}/gensor/io/read.py +0 -0
  20. {gensor-0.2.3 → gensor-0.2.4}/gensor/log.py +0 -0
  21. {gensor-0.2.3 → gensor-0.2.4}/gensor/parse/__init__.py +0 -0
  22. {gensor-0.2.3 → gensor-0.2.4}/gensor/parse/plain.py +0 -0
  23. {gensor-0.2.3 → gensor-0.2.4}/gensor/parse/utils.py +0 -0
  24. {gensor-0.2.3 → gensor-0.2.4}/gensor/parse/vanessen.py +0 -0
  25. {gensor-0.2.3 → gensor-0.2.4}/gensor/processing/__init__.py +0 -0
  26. {gensor-0.2.3 → gensor-0.2.4}/gensor/processing/compensation.py +0 -0
  27. {gensor-0.2.3 → gensor-0.2.4}/gensor/processing/smoothing.py +0 -0
  28. {gensor-0.2.3 → gensor-0.2.4}/gensor/processing/transform.py +0 -0
  29. {gensor-0.2.3 → gensor-0.2.4}/gensor/testdata/Barodiver_220427183008_BY222.csv +0 -0
  30. {gensor-0.2.3 → gensor-0.2.4}/gensor/testdata/PB01A_moni_AV319_220427183019_AV319.csv +0 -0
  31. {gensor-0.2.3 → gensor-0.2.4}/gensor/testdata/PB02A_plain.csv +0 -0
  32. {gensor-0.2.3 → gensor-0.2.4}/gensor/testdata/__init__.py +0 -0
  33. {gensor-0.2.3 → gensor-0.2.4}/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gensor
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Library for handling groundwater sensor data.
5
5
  Home-page: https://github.com/zawadzkim/gensor
6
6
  Author: Mateusz Zawadzki
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import uuid
4
+ from copy import deepcopy
4
5
  from typing import Any, Literal, TypeVar
5
6
 
6
7
  import pandas as pd
@@ -107,7 +108,9 @@ class BaseTimeseries(pyd.BaseModel):
107
108
  result = ts_attr(*args, **kwargs)
108
109
  # If the result is a Series, return a new Timeseries; otherwise, return the result
109
110
  if isinstance(result, pd.Series):
110
- return self.model_copy(update={"ts": result}, deep=True)
111
+ return self.model_copy(
112
+ update={"ts": deepcopy(result)}, deep=True
113
+ )
111
114
 
112
115
  return result
113
116
 
@@ -36,6 +36,10 @@ class Dataset(pyd.BaseModel, Generic[T]):
36
36
  def __getitem__(self, index: int) -> T | None:
37
37
  """Retrieve a Timeseries object by its index in the dataset.
38
38
 
39
+ !!! warning
40
+ Using index will return the reference to the timeseries. If you need a copy,
41
+ use .filter() instead of Dataset[index]
42
+
39
43
  Parameters:
40
44
  index (int): The index of the Timeseries to retrieve.
41
45
 
@@ -46,7 +50,7 @@ class Dataset(pyd.BaseModel, Generic[T]):
46
50
  IndexError: If the index is out of range.
47
51
  """
48
52
  try:
49
- return self.timeseries[index].model_copy(deep=True)
53
+ return self.timeseries[index]
50
54
  except IndexError:
51
55
  raise IndexOutOfRangeError(index, len(self)) from None
52
56
 
@@ -18,12 +18,12 @@ class TimeseriesIndexer:
18
18
  self.indexer = indexer
19
19
 
20
20
  def __getitem__(self, key: str) -> Any:
21
- """Allows using the indexer (e.g., loc) and wraps the result in a Timeseries."""
21
+ """Allows using the indexer (e.g., loc) and wraps the result in the parent Timeseries."""
22
22
 
23
23
  result = self.indexer[key]
24
24
 
25
25
  if isinstance(result, pd.Series):
26
- return self.parent.model_copy(update={"ts": result}, deep=True)
26
+ return self.parent.model_copy(update={"ts": result}, deep=False)
27
27
 
28
28
  if isinstance(result, (int | float | str | pd.Timestamp | np.float64)):
29
29
  return result
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "gensor"
3
- version = "0.2.3"
3
+ version = "0.2.4"
4
4
  description = "Library for handling groundwater sensor data."
5
5
  authors = ["Mateusz Zawadzki <zawadzkimat@outlook.com>"]
6
6
  repository = "https://github.com/zawadzkim/gensor"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes