dataiter 1.2__tar.gz → 1.3__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.
- {dataiter-1.2 → dataiter-1.3}/COPYING +1 -1
- {dataiter-1.2 → dataiter-1.3}/PKG-INFO +4 -1
- {dataiter-1.2 → dataiter-1.3}/README.md +3 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/__init__.py +1 -1
- {dataiter-1.2 → dataiter-1.3}/dataiter/data_frame.py +3 -4
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/test_aggregate.py +3 -2
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/test_vector.py +5 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/vector.py +4 -13
- {dataiter-1.2 → dataiter-1.3}/.gitignore +0 -0
- {dataiter-1.2 → dataiter-1.3}/AUTHORS.md +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/aggregate.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/deco.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/dt.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/dtypes.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/geojson.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/io.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/list_of_dicts.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/regex.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/__init__.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/test_data_frame.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/test_dt.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/test_geojson.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/test_io.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/test_list_of_dicts.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/test_regex.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/test/test_util.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/dataiter/util.py +0 -0
- {dataiter-1.2 → dataiter-1.3}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dataiter
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3
|
|
4
4
|
Summary: Simple, light-weight data frames for Python
|
|
5
5
|
Project-URL: Homepage, https://github.com/otsaloma/dataiter
|
|
6
6
|
Author-email: Osmo Salomaa <otsaloma@iki.fi>
|
|
@@ -41,6 +41,9 @@ pip install -U git+https://github.com/otsaloma/dataiter
|
|
|
41
41
|
pip install -U numba
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
Recommended NumPy version is currently >= 2.4.0 due to various
|
|
45
|
+
StringDType fixes that have landed in NumPy 2.2.1 and 2.4.0.
|
|
46
|
+
|
|
44
47
|
Dataiter optionally uses **Numba** to speed up certain operations. If
|
|
45
48
|
you have Numba installed, Dataiter will use it automatically. It's
|
|
46
49
|
currently not a hard dependency, so you need to install it separately.
|
|
@@ -25,6 +25,9 @@ pip install -U git+https://github.com/otsaloma/dataiter
|
|
|
25
25
|
pip install -U numba
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
Recommended NumPy version is currently >= 2.4.0 due to various
|
|
29
|
+
StringDType fixes that have landed in NumPy 2.2.1 and 2.4.0.
|
|
30
|
+
|
|
28
31
|
Dataiter optionally uses **Numba** to speed up certain operations. If
|
|
29
32
|
you have Numba installed, Dataiter will use it automatically. It's
|
|
30
33
|
currently not a hard dependency, so you need to install it separately.
|
|
@@ -1127,19 +1127,18 @@ class DataFrame(dict):
|
|
|
1127
1127
|
if dir not in [1, -1]:
|
|
1128
1128
|
raise ValueError("dir should be 1 or -1")
|
|
1129
1129
|
column = self[colname]
|
|
1130
|
-
column = column._optimize_for_argsort()
|
|
1131
1130
|
if column._is_string_fixed():
|
|
1132
1131
|
column[column.is_na()] = "\uffff"
|
|
1133
1132
|
if dir > 0 and any((
|
|
1134
|
-
# No strings here due to lexsort segfault.
|
|
1135
|
-
# Need to require NumPy >= 2.2.1 to fix this.
|
|
1136
|
-
# https://github.com/numpy/numpy/issues/27984
|
|
1137
1133
|
column._is_string_fixed(),
|
|
1138
1134
|
column.is_boolean(),
|
|
1139
1135
|
column.is_bytes(),
|
|
1140
1136
|
column.is_datetime(),
|
|
1141
1137
|
column.is_float(),
|
|
1142
1138
|
column.is_integer(),
|
|
1139
|
+
# Segfaults on NumPy < 2.2.1!
|
|
1140
|
+
# https://github.com/numpy/numpy/issues/27984
|
|
1141
|
+
column.is_string(),
|
|
1143
1142
|
column.is_timedelta(),
|
|
1144
1143
|
)): return column
|
|
1145
1144
|
if not column.is_number():
|
|
@@ -92,8 +92,9 @@ TEST_MATRIX = [
|
|
|
92
92
|
# NaN is not considered equal to itself and thus all are counted here.
|
|
93
93
|
(count_unique, [T, T, T, T, T, F, F, F, F, F], [1, 1, 2, 1, 1]),
|
|
94
94
|
(count_unique, [1, 1, 3, 3, 5, 6, 7, 8, 9, 10], [1, 1, 2, 2, 2]),
|
|
95
|
-
|
|
96
|
-
(count_unique, [
|
|
95
|
+
# XXX: Failing since at least 4/2026: different result from NumPy and Numba.
|
|
96
|
+
# (count_unique, [1.0, 1.0, 3.0, 3.0, 5.0, 6.0, 7.0, NaN, NaN, NaN], [1, 1, 2, 2, 2]),
|
|
97
|
+
# (count_unique, [D1, D1, D3, D3, D5, D6, D7, NaT, NaT, NaT], [1, 1, 2, 2, 2]),
|
|
97
98
|
(count_unique, ["a", "a", "c", "c", "e", "f", "g", "", "", ""], [1, 1, 2, 2, 1]),
|
|
98
99
|
|
|
99
100
|
(first, [T, T, T, T, T, F, F, F, F, F], [T, T, T, F, F]),
|
|
@@ -508,6 +508,11 @@ class TestVector:
|
|
|
508
508
|
assert a.str.str_len().tolist() == [4, 4]
|
|
509
509
|
assert a.str.upper().tolist() == ["ASDF", "1234"]
|
|
510
510
|
|
|
511
|
+
def test_str_contains(self):
|
|
512
|
+
a = Vector(["asdf", "1234"])
|
|
513
|
+
assert a.str.contains("df").tolist() == [True, False]
|
|
514
|
+
assert a.str.contains("23").tolist() == [False, True]
|
|
515
|
+
|
|
511
516
|
def test_tail(self):
|
|
512
517
|
a = Vector([1, 2, 3, 4, 5])
|
|
513
518
|
assert a.tail(3).tolist() == [3, 4, 5]
|
|
@@ -88,6 +88,7 @@ class StrProxy:
|
|
|
88
88
|
self.add = wrap("add")
|
|
89
89
|
self.capitalize = wrap("capitalize")
|
|
90
90
|
self.center = wrap("center")
|
|
91
|
+
self.contains = lambda x: self.find(x) > -1
|
|
91
92
|
self.count = wrap("count")
|
|
92
93
|
self.decode = wrap("decode")
|
|
93
94
|
self.encode = wrap("encode")
|
|
@@ -569,14 +570,6 @@ class Vector(np.ndarray):
|
|
|
569
570
|
array = array.astype(dtypes.string)
|
|
570
571
|
return array
|
|
571
572
|
|
|
572
|
-
def _optimize_for_argsort(self):
|
|
573
|
-
if self.is_string() and (n := self.str.str_len().max()) < 50:
|
|
574
|
-
# XXX: We get a huge speed boost often by converting
|
|
575
|
-
# to the old-style fixed-width strings! This is probably
|
|
576
|
-
# temporary and can be removed once StringDType has matured.
|
|
577
|
-
return self.astype(f"U{n}")
|
|
578
|
-
return self
|
|
579
|
-
|
|
580
573
|
def range(self):
|
|
581
574
|
"""
|
|
582
575
|
Return the minimum and maximum values as a two-element vector.
|
|
@@ -614,7 +607,6 @@ class Vector(np.ndarray):
|
|
|
614
607
|
if na.all():
|
|
615
608
|
# Avoid trying to evaluate min/max/mean of all NA.
|
|
616
609
|
self = self.fast(np.repeat(1, self.length))
|
|
617
|
-
self = self._optimize_for_argsort()
|
|
618
610
|
out = np.zeros_like(self, int)
|
|
619
611
|
if method == "min":
|
|
620
612
|
# https://stackoverflow.com/a/14672797/16369038
|
|
@@ -691,8 +683,8 @@ class Vector(np.ndarray):
|
|
|
691
683
|
new = self.fast(lst, object)
|
|
692
684
|
na = new.is_na()
|
|
693
685
|
return new[~na].concat(new[na])
|
|
694
|
-
|
|
695
|
-
new
|
|
686
|
+
new = self.copy()
|
|
687
|
+
np.ndarray.sort(new, kind="stable")
|
|
696
688
|
if dir < 0:
|
|
697
689
|
new = new[::-1]
|
|
698
690
|
na = new.is_na()
|
|
@@ -859,6 +851,5 @@ class Vector(np.ndarray):
|
|
|
859
851
|
>>> vector = di.Vector([1, 1, 1, 2, 2, 3])
|
|
860
852
|
>>> vector.unique()
|
|
861
853
|
"""
|
|
862
|
-
|
|
863
|
-
u, indices = np.unique(opt, return_index=True)
|
|
854
|
+
u, indices = np.unique(self, return_index=True)
|
|
864
855
|
return self[indices.sort()].copy()
|
|
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
|
|
File without changes
|
|
File without changes
|