hopeit.dataframes 0.25.0b5__tar.gz → 0.25.0b7__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 (19) hide show
  1. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/PKG-INFO +2 -2
  2. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit/dataframes/dataframe.py +21 -4
  3. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit.dataframes.egg-info/PKG-INFO +2 -2
  4. hopeit_dataframes-0.25.0b7/src/hopeit.dataframes.egg-info/requires.txt +6 -0
  5. hopeit_dataframes-0.25.0b5/src/hopeit.dataframes.egg-info/requires.txt +0 -6
  6. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/README.md +0 -0
  7. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/setup.cfg +0 -0
  8. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/setup.py +0 -0
  9. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit/dataframes/__init__.py +0 -0
  10. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit/dataframes/py.typed +0 -0
  11. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit/dataframes/serialization/__init__.py +0 -0
  12. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit/dataframes/serialization/dataset.py +0 -0
  13. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit/dataframes/serialization/files.py +0 -0
  14. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit/dataframes/serialization/settings.py +0 -0
  15. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit/dataframes/setup/__init__.py +0 -0
  16. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit/dataframes/setup/dataframes.py +0 -0
  17. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit.dataframes.egg-info/SOURCES.txt +0 -0
  18. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit.dataframes.egg-info/dependency_links.txt +0 -0
  19. {hopeit_dataframes-0.25.0b5 → hopeit_dataframes-0.25.0b7}/src/hopeit.dataframes.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hopeit.dataframes
3
- Version: 0.25.0b5
3
+ Version: 0.25.0b7
4
4
  Summary: Hopeit Engine Dataframes Toolkit
5
5
  Home-page: https://github.com/hopeit-git/hopeit.engine
6
6
  Author: Leo Smerling and Pablo Canto
@@ -26,7 +26,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
26
  Classifier: Framework :: AsyncIO
27
27
  Requires-Python: >=3.8
28
28
  Description-Content-Type: text/markdown
29
- Requires-Dist: hopeit.engine[fs-storage]==0.25.0b5
29
+ Requires-Dist: hopeit.engine[fs-storage]==0.25.0b7
30
30
  Requires-Dist: pandas
31
31
  Requires-Dist: numpy
32
32
  Provides-Extra: pyarrow
@@ -3,6 +3,7 @@ DataFrames type abstractions.
3
3
  """
4
4
  import dataclasses
5
5
  from datetime import date, datetime, timezone
6
+ from functools import partial
6
7
  from typing import Any, Callable, Dict, Generic, Iterator, List, Type, TypeVar
7
8
 
8
9
  import numpy as np
@@ -28,6 +29,22 @@ class DataFrameMetadata():
28
29
  fields: Dict[str, FieldInfo]
29
30
 
30
31
 
32
+ # Functions to do type coercion
33
+ def _series_to_int(x: pd.Series) -> pd.Series:
34
+ return x.astype(np.int64)
35
+
36
+
37
+ def _series_to_float(x: pd.Series) -> pd.Series:
38
+ return x.astype(np.float64)
39
+
40
+
41
+ def _series_to_str(x: pd.Series) -> pd.Series:
42
+ return x.astype(str)
43
+
44
+
45
+ _series_to_utc_datetime = partial(pd.to_datetime, utc=True)
46
+
47
+
31
48
  class DataFrameMixin(Generic[DataFrameT, DataObject]):
32
49
  """
33
50
  MixIn class to add functionality for DataFrames dataobjects
@@ -36,11 +53,11 @@ class DataFrameMixin(Generic[DataFrameT, DataObject]):
36
53
  """
37
54
 
38
55
  DATATYPE_MAPPING = {
39
- int: lambda x: x.astype(np.int64),
40
- float: lambda x: x.astype(np.float64),
41
- str: lambda x: x.astype(object),
56
+ int: _series_to_int,
57
+ float: _series_to_float,
58
+ str: _series_to_str,
42
59
  date: pd.to_datetime,
43
- datetime: pd.to_datetime,
60
+ datetime: _series_to_utc_datetime,
44
61
  }
45
62
 
46
63
  def __init__(self) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hopeit.dataframes
3
- Version: 0.25.0b5
3
+ Version: 0.25.0b7
4
4
  Summary: Hopeit Engine Dataframes Toolkit
5
5
  Home-page: https://github.com/hopeit-git/hopeit.engine
6
6
  Author: Leo Smerling and Pablo Canto
@@ -26,7 +26,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
26
  Classifier: Framework :: AsyncIO
27
27
  Requires-Python: >=3.8
28
28
  Description-Content-Type: text/markdown
29
- Requires-Dist: hopeit.engine[fs-storage]==0.25.0b5
29
+ Requires-Dist: hopeit.engine[fs-storage]==0.25.0b7
30
30
  Requires-Dist: pandas
31
31
  Requires-Dist: numpy
32
32
  Provides-Extra: pyarrow
@@ -0,0 +1,6 @@
1
+ hopeit.engine[fs-storage]==0.25.0b7
2
+ pandas
3
+ numpy
4
+
5
+ [pyarrow]
6
+ pyarrow
@@ -1,6 +0,0 @@
1
- hopeit.engine[fs-storage]==0.25.0b5
2
- pandas
3
- numpy
4
-
5
- [pyarrow]
6
- pyarrow