dukit 0.2.4__tar.gz → 0.2.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dukit
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: dukit - data utilities kit for exploring, modifying and visualizing small but messy data using pandas
5
5
  Keywords: pandas,query,utility,data,diff
6
6
  Author: MartinVoelkl94
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dukit"
3
- version = "0.2.4"
3
+ version = "0.2.6"
4
4
  description = "dukit - data utilities kit for exploring, modifying and visualizing small but messy data using pandas"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "MartinVoelkl94", email = "martinv16248@gmail.com" }]
@@ -1,11 +1,7 @@
1
1
 
2
- from .utils import (
3
- log,
4
- )
5
- from .diffing import (
6
- diff,
7
- rediff,
8
- )
2
+ from importlib.metadata import version
3
+ __version__ = version('dukit')
4
+
9
5
  from . import qlang
10
6
  from .qlang import (
11
7
  q,
@@ -13,23 +9,46 @@ from .qlang import (
13
9
  qs,
14
10
  )
15
11
  from .interfaces import (
16
- DukitAccessor,
12
+ DukitAccessor
13
+ )
14
+ from .diffing import (
15
+ diff,
16
+ rediff,
17
+ )
18
+ from .utils import (
19
+ log,
20
+ ensure_unique_string,
21
+ )
22
+ from .excel import (
23
+ format,
24
+ save,
17
25
  )
18
26
  from .pandas import (
19
- get_df,
20
- get_dfs,
27
+ collapse,
28
+ date_delta,
29
+ date_table,
21
30
  deduplicate,
31
+ embed,
22
32
  flatten,
33
+ get_df,
34
+ get_df_patients,
35
+ get_df_medications,
36
+ get_df_old,
37
+ get_df_new,
23
38
  stagger,
24
- embed,
25
- collapse,
26
39
  transpose,
27
- date_delta,
28
- date_table,
40
+ split_col,
29
41
  )
30
- from .excel import (
31
- format,
32
- save,
42
+ from .os import (
43
+ cd,
44
+ cp,
45
+ fetch,
46
+ isdir,
47
+ isfile,
48
+ ispath,
49
+ mv,
50
+ mkdir,
51
+ pwd,
33
52
  )
34
53
  from .typing import (
35
54
  Box,
@@ -44,44 +63,57 @@ from .typing import (
44
63
  nk_ as nk,
45
64
  yn_ as yn,
46
65
  type_ as type,
66
+ dtype_ as dtype,
47
67
  convert_ as convert,
48
68
  typeinfo_ as typeinfo,
49
69
  typeinfostrict_ as typeinfostrict,
50
70
  list_ as list,
51
71
  )
52
- from .os import (
53
- pwd,
54
- cd,
55
- cp,
56
- mv,
57
- mkdir,
58
- isdir,
59
- isfile,
60
- ispath,
61
- fetch,
62
- )
72
+
63
73
 
64
74
  __all__ = (
65
- 'log',
66
- 'diff',
67
- 'rediff',
75
+ '__version__',
76
+
68
77
  'qlang',
69
78
  'q',
70
79
  'qr',
71
80
  'qs',
72
81
  'DukitAccessor',
73
- 'get_df',
74
- 'get_dfs',
82
+
83
+ 'diff',
84
+ 'rediff',
85
+
86
+ 'log',
87
+ 'ensure_unique_string',
88
+
89
+ 'format',
90
+ 'save',
91
+
92
+ 'collapse',
93
+ 'date_delta',
94
+ 'date_table',
75
95
  'deduplicate',
96
+ 'embed',
76
97
  'flatten',
98
+ 'get_df',
99
+ 'get_df_patients',
100
+ 'get_df_medications',
101
+ 'get_df_old',
102
+ 'get_df_new',
77
103
  'stagger',
78
- 'embed',
79
- 'collapse',
80
104
  'transpose',
81
- 'date_delta',
82
- 'date_table',
83
- 'format',
84
- 'save',
105
+ 'split_col',
106
+
107
+ 'cd',
108
+ 'cp',
109
+ 'fetch',
110
+ 'isdir',
111
+ 'isfile',
112
+ 'ispath',
113
+ 'mv',
114
+ 'mkdir',
115
+ 'pwd',
116
+
85
117
  'Box',
86
118
  'str',
87
119
  'int',
@@ -94,17 +126,9 @@ __all__ = (
94
126
  'nk',
95
127
  'yn',
96
128
  'type',
129
+ 'dtype',
97
130
  'convert',
98
131
  'typeinfo',
99
132
  'typeinfostrict',
100
133
  'list',
101
- 'pwd',
102
- 'cd',
103
- 'cp',
104
- 'mv',
105
- 'mkdir',
106
- 'isdir',
107
- 'isfile',
108
- 'ispath',
109
- 'fetch',
110
134
  )
@@ -1,5 +1,6 @@
1
1
 
2
2
  import pandas as pd
3
+
3
4
  from .utils import (
4
5
  GREEN,
5
6
  RED,
@@ -32,51 +33,6 @@ def _setup_xlsx(df_old, df_new, tmpdir):
32
33
 
33
34
 
34
35
 
35
- def _get_dfs():
36
-
37
- df_old = pd.DataFrame(
38
- columns=['a', 'b', 'c'],
39
- index=['x', 'y', 'z', ],
40
- )
41
-
42
- df_old.insert(0, 'uid', df_old.index)
43
-
44
- df_old.loc['x', 'a'] = 1
45
- df_old.loc['x', 'b'] = 1
46
- df_old.loc['x', 'c'] = 1
47
-
48
- df_old.loc['y', 'a'] = 2
49
- df_old.loc['y', 'b'] = 2
50
- df_old.loc['y', 'c'] = 2
51
-
52
- df_old.loc['z', 'a'] = 3
53
- df_old.loc['z', 'b'] = None
54
- df_old.loc['z', 'c'] = 3
55
-
56
-
57
- df_new = pd.DataFrame(
58
- columns=['d', 'b', 'a'],
59
- index=['y', 'x2', 'z', ],
60
- )
61
-
62
- df_new.insert(0, 'uid', df_new.index)
63
-
64
- df_new.loc['y', 'd'] = 2
65
- df_new.loc['y', 'b'] = 2
66
- df_new.loc['y', 'a'] = 0
67
-
68
- df_new.loc['x2', 'd'] = 1
69
- df_new.loc['x2', 'b'] = 1
70
- df_new.loc['x2', 'a'] = 1
71
-
72
- df_new.loc['z', 'd'] = 3
73
- df_new.loc['z', 'b'] = 3
74
- df_new.loc['z', 'a'] = pd.NA
75
-
76
- return df_old, df_new
77
-
78
-
79
-
80
36
  def _get_expected_new():
81
37
 
82
38
  uid = pd.Series(
@@ -85,7 +41,7 @@ def _get_expected_new():
85
41
  name='uid',
86
42
  )
87
43
  expected = pd.DataFrame(
88
- columns=['uid', 'diff', 'd', 'b', 'a'],
44
+ columns=['diff', 'uid', 'd', 'b', 'a'],
89
45
  index=uid,
90
46
  )
91
47
 
@@ -120,7 +76,7 @@ def _get_expected_newplus():
120
76
  name='uid',
121
77
  )
122
78
  expected = pd.DataFrame(
123
- columns=['uid', 'diff', 'd', 'b', 'b *old', 'a', 'a *old'],
79
+ columns=['diff', 'uid', 'd', 'b', 'b *old', 'a', 'a *old'],
124
80
  index=uid,
125
81
  )
126
82
 
@@ -164,7 +120,7 @@ def _get_expected_old():
164
120
  name='uid',
165
121
  )
166
122
  expected = pd.DataFrame(
167
- columns=['uid', 'diff', 'a', 'b', 'c'],
123
+ columns=['diff', 'uid', 'a', 'b', 'c'],
168
124
  index=uid,
169
125
  )
170
126
 
@@ -199,7 +155,7 @@ def _get_expected_mix():
199
155
  name='uid',
200
156
  )
201
157
  expected = pd.DataFrame(
202
- columns=['uid', 'diff', 'd', 'b', 'a', 'c'],
158
+ columns=['diff', 'uid', 'd', 'b', 'a', 'c'],
203
159
  index=uid,
204
160
  )
205
161