data-manipulation-utilities 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl

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.
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: data_manipulation_utilities
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Description-Content-Type: text/markdown
5
5
  Requires-Dist: zfit
6
+ Requires-Dist: logzero
6
7
  Requires-Dist: PyYAML
7
8
  Requires-Dist: scipy
8
9
  Requires-Dist: awkward
@@ -401,27 +402,6 @@ obj = AtrMgr(rdf)
401
402
  obj.to_json('/path/to/file.json')
402
403
  ```
403
404
 
404
- # Dataframes
405
-
406
- Polars is very fast, however the interface of polars is not simple. Therefore this project has a derived class
407
- called `DataFrame`, which implements a more user-friendly interface. It can be used as:
408
-
409
- ```python
410
- from dmu.dataframe.dataframe import DataFrame
411
-
412
- df = DataFrame({
413
- 'a': [1, 2, 3],
414
- 'b': [4, 5, 6]
415
- })
416
-
417
-
418
- # Defining a new column
419
- df = df.define('c', 'a + b')
420
-
421
- ```
422
-
423
- The remaining functionality is identical to `polars`.
424
-
425
405
  # Logging
426
406
 
427
407
  The `LogStore` class is an interface to the `logging` module. It is aimed at making it easier to include
@@ -1,5 +1,4 @@
1
1
  dmu/arrays/utilities.py,sha256=PKoYyybPptA2aU-V3KLnJXBudWxTXu4x1uGdIMQ49HY,1722
2
- dmu/dataframe/dataframe.py,sha256=ZgRCw5hN18gOXGL9nHDc4eNi0P8lOIAIEILmbEiTlXw,1088
3
2
  dmu/generic/utilities.py,sha256=0Xnq9t35wuebAqKxbyAiMk1ISB7IcXK4cFH25MT1fgw,1741
4
3
  dmu/logging/log_store.py,sha256=v0tiNz-6ktT_afD5DuvCZ8Nmr82JKQOPli8hgd28P1Q,3960
5
4
  dmu/ml/cv_classifier.py,sha256=n81m7i2M6Zq96AEd9EZGwXSrbG5m9jkS5RdeXvbsAXU,3712
@@ -38,8 +37,8 @@ dmu_scripts/rfile/compare_root_files.py,sha256=T8lDnQxsRNMr37x1Y7YvWD8ySHrJOWZki
38
37
  dmu_scripts/rfile/print_trees.py,sha256=Ze4Ccl_iUldl4eVEDVnYBoe4amqBT1fSBR1zN5WSztk,941
39
38
  dmu_scripts/ssh/coned.py,sha256=lhilYNHWRCGxC-jtyJ3LQ4oUgWW33B2l1tYCcyHHsR0,4858
40
39
  dmu_scripts/text/transform_text.py,sha256=9akj1LB0HAyopOvkLjNOJiptZw5XoOQLe17SlcrGMD0,1456
41
- data_manipulation_utilities-0.0.2.dist-info/METADATA,sha256=-Ol5gBaJ67iyDGN70TAKW5Putdd_ga66W42n1NrIBLA,19714
42
- data_manipulation_utilities-0.0.2.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
43
- data_manipulation_utilities-0.0.2.dist-info/entry_points.txt,sha256=1TIZDed651KuOH-DgaN5AoBdirKmrKE_oM1b6b7zTUU,270
44
- data_manipulation_utilities-0.0.2.dist-info/top_level.txt,sha256=n_x5J6uWtSqy9mRImKtdA2V2NJNyU8Kn3u8DTOKJix0,25
45
- data_manipulation_utilities-0.0.2.dist-info/RECORD,,
40
+ data_manipulation_utilities-0.0.4.dist-info/METADATA,sha256=KdnERW9iQpDf8vz-m7-VWKgMPHrK5L2NEhfTkWRKtys,19299
41
+ data_manipulation_utilities-0.0.4.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
42
+ data_manipulation_utilities-0.0.4.dist-info/entry_points.txt,sha256=1TIZDed651KuOH-DgaN5AoBdirKmrKE_oM1b6b7zTUU,270
43
+ data_manipulation_utilities-0.0.4.dist-info/top_level.txt,sha256=n_x5J6uWtSqy9mRImKtdA2V2NJNyU8Kn3u8DTOKJix0,25
44
+ data_manipulation_utilities-0.0.4.dist-info/RECORD,,
@@ -1,36 +0,0 @@
1
- '''
2
- Class re-implementing dataframe, meant to be a thin layer on top of polars
3
- '''
4
-
5
- import polars as pl
6
-
7
- # ------------------------------------------
8
- class DataFrame(pl.DataFrame):
9
- '''
10
- Class reimplementing dataframes from polars
11
- '''
12
- # ------------------------------------------
13
- def __init__(self, *args, **kwargs):
14
- super().__init__(*args, **kwargs)
15
- # ------------------------------------------
16
- def define(self, name : str, expr : str):
17
- '''
18
- Function will define new column in dataframe
19
-
20
- name (str): Name of new column
21
- expr (str): Expression depending on existing columns
22
- '''
23
-
24
- for col in self.columns:
25
- expr = expr.replace(col, f' {col} ')
26
-
27
- for col in self.columns:
28
- expr = expr.replace(f' {col} ', f' pl.col("{col}") ')
29
-
30
- try:
31
- df = self.with_columns(eval(expr).alias(name))
32
- except TypeError as exc:
33
- raise TypeError(f'Cannot define {expr} -> {name}') from exc
34
-
35
- return DataFrame(df)
36
- # ------------------------------------------