dataiter 1.4__tar.gz → 2.0__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.4 → dataiter-2.0}/.gitignore +3 -2
- {dataiter-1.4 → dataiter-2.0}/PKG-INFO +24 -28
- {dataiter-1.4 → dataiter-2.0}/README.md +17 -23
- {dataiter-1.4 → dataiter-2.0}/dataiter/__init__.py +34 -45
- dataiter-2.0/dataiter/aggregate.py +586 -0
- dataiter-2.0/dataiter/data_frame.py +2216 -0
- {dataiter-1.4 → dataiter-2.0}/dataiter/deco.py +21 -0
- dataiter-2.0/dataiter/dt.py +508 -0
- {dataiter-1.4 → dataiter-2.0}/dataiter/dtypes.py +0 -8
- {dataiter-1.4 → dataiter-2.0}/dataiter/geojson.py +33 -21
- {dataiter-1.4 → dataiter-2.0}/dataiter/io.py +21 -10
- {dataiter-1.4 → dataiter-2.0}/dataiter/list_of_dicts.py +406 -145
- {dataiter-1.4 → dataiter-2.0}/dataiter/regex.py +60 -15
- {dataiter-1.4 → dataiter-2.0}/dataiter/test/test_aggregate.py +204 -46
- dataiter-2.0/dataiter/test/test_data_frame.py +1817 -0
- dataiter-2.0/dataiter/test/test_dt.py +398 -0
- {dataiter-1.4 → dataiter-2.0}/dataiter/test/test_geojson.py +37 -5
- {dataiter-1.4 → dataiter-2.0}/dataiter/test/test_io.py +5 -0
- {dataiter-1.4 → dataiter-2.0}/dataiter/test/test_list_of_dicts.py +399 -16
- {dataiter-1.4 → dataiter-2.0}/dataiter/test/test_regex.py +24 -0
- {dataiter-1.4 → dataiter-2.0}/dataiter/test/test_util.py +38 -12
- {dataiter-1.4 → dataiter-2.0}/dataiter/test/test_vector.py +415 -3
- dataiter-2.0/dataiter/util.py +290 -0
- dataiter-2.0/dataiter/vector.py +1277 -0
- {dataiter-1.4 → dataiter-2.0}/pyproject.toml +15 -2
- dataiter-1.4/dataiter/aggregate.py +0 -661
- dataiter-1.4/dataiter/data_frame.py +0 -1365
- dataiter-1.4/dataiter/dt.py +0 -291
- dataiter-1.4/dataiter/test/test_data_frame.py +0 -844
- dataiter-1.4/dataiter/test/test_dt.py +0 -174
- dataiter-1.4/dataiter/util.py +0 -169
- dataiter-1.4/dataiter/vector.py +0 -864
- {dataiter-1.4 → dataiter-2.0}/AUTHORS.md +0 -0
- {dataiter-1.4 → dataiter-2.0}/COPYING +0 -0
- {dataiter-1.4 → dataiter-2.0}/dataiter/test/__init__.py +0 -0
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
.env
|
|
3
3
|
.envrc
|
|
4
4
|
.pytest_cache
|
|
5
|
+
.venv
|
|
5
6
|
__pycache__
|
|
6
|
-
benchmark-head.py
|
|
7
7
|
benchmark-versions.csv
|
|
8
8
|
benchmark-versions.ods
|
|
9
9
|
build
|
|
@@ -11,6 +11,7 @@ dist
|
|
|
11
11
|
doc/_build
|
|
12
12
|
doc/comparison/comparison.html
|
|
13
13
|
test.py
|
|
14
|
+
tmp
|
|
14
15
|
tmp.csv
|
|
16
|
+
uv.lock
|
|
15
17
|
validation/*.csv
|
|
16
|
-
venv
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: dataiter
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0
|
|
4
4
|
Summary: Simple, light-weight data frames for Python
|
|
5
5
|
Project-URL: Homepage, https://github.com/otsaloma/dataiter
|
|
6
|
+
Project-URL: Documentation, https://dataiter.readthedocs.io/
|
|
7
|
+
Project-URL: Changelog, https://github.com/otsaloma/dataiter/blob/master/NEWS.md
|
|
6
8
|
Author-email: Osmo Salomaa <otsaloma@iki.fi>
|
|
7
9
|
License-Expression: MIT
|
|
8
10
|
License-File: AUTHORS.md
|
|
9
11
|
License-File: COPYING
|
|
10
|
-
Requires-Python: >=3.
|
|
12
|
+
Requires-Python: >=3.12.0
|
|
11
13
|
Requires-Dist: attd>=0.3
|
|
12
|
-
Requires-Dist: numpy<3.0,>=2.
|
|
13
|
-
Requires-Dist: pyarrow>=
|
|
14
|
-
Requires-Dist: wcwidth>=0.
|
|
14
|
+
Requires-Dist: numpy<3.0,>=2.5.0
|
|
15
|
+
Requires-Dist: pyarrow>=26.0
|
|
16
|
+
Requires-Dist: wcwidth>=0.3.0
|
|
15
17
|
Description-Content-Type: text/markdown
|
|
16
18
|
|
|
17
19
|
# Simple, Light-Weight Data Frames for Python
|
|
@@ -24,8 +26,9 @@ Dataiter's **`DataFrame`** is a class for tabular data similar to R's
|
|
|
24
26
|
is under the hood a dictionary of NumPy arrays and thus capable of fast
|
|
25
27
|
vectorized operations. You can consider it to be a light-weight
|
|
26
28
|
alternative to Pandas with a simple and consistent API. Performance-wise
|
|
27
|
-
Dataiter relies on NumPy and
|
|
28
|
-
|
|
29
|
+
Dataiter relies on NumPy and PyArrow and is close to the level of
|
|
30
|
+
Pandas. Currently the notable slow part is string data and operations
|
|
31
|
+
(Dataiter's NumPy StringDType being slower than Pandas' Arrow strings).
|
|
29
32
|
|
|
30
33
|
## Installation
|
|
31
34
|
|
|
@@ -35,18 +38,8 @@ pip install -U dataiter
|
|
|
35
38
|
|
|
36
39
|
# Latest development version
|
|
37
40
|
pip install -U git+https://github.com/otsaloma/dataiter
|
|
38
|
-
|
|
39
|
-
# Numba (optional)
|
|
40
|
-
pip install -U numba
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Recommended NumPy version is currently >= 2.4.0 due to various
|
|
44
|
-
StringDType fixes that have landed in NumPy 2.2.1 and 2.4.0.
|
|
45
|
-
|
|
46
|
-
Dataiter optionally uses **Numba** to speed up certain operations. If
|
|
47
|
-
you have Numba installed, Dataiter will use it automatically. It's
|
|
48
|
-
currently not a hard dependency, so you need to install it separately.
|
|
49
|
-
|
|
50
43
|
## Quick Start
|
|
51
44
|
|
|
52
45
|
```python
|
|
@@ -80,20 +73,23 @@ the differences and similarities in common operations.
|
|
|
80
73
|
|
|
81
74
|
https://dataiter.readthedocs.io/en/stable/comparison.html
|
|
82
75
|
|
|
83
|
-
For
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
### For Coding Agents
|
|
77
|
+
|
|
78
|
+
Dataiter's API is small enough that the complete documentation fits in
|
|
79
|
+
about 50k tokens. Coding agents can read all of it in one go and know
|
|
80
|
+
the whole API before writing any code. This differs from bigger
|
|
81
|
+
packages, like Pandas and Polars, which must fight against outdated
|
|
82
|
+
training data and introduce their huge API piecemeal, hoping the agent
|
|
83
|
+
knows what to ask for. For best results, have your agent download
|
|
84
|
+
`llms-full.txt` and read it in full, rather than fetch it with a tool
|
|
85
|
+
that summarizes web pages. Each documentation page is also available as
|
|
86
|
+
Markdown by replacing `.html` with `.md` in the URL.
|
|
86
87
|
|
|
87
|
-
- https://dataiter.readthedocs.io/en/stable/data-frame.md
|
|
88
|
-
- https://dataiter.readthedocs.io/en/stable/llms.txt
|
|
89
88
|
- https://dataiter.readthedocs.io/en/stable/llms-full.txt
|
|
89
|
+
- https://dataiter.readthedocs.io/en/stable/data-frame.md
|
|
90
90
|
|
|
91
91
|
## Development
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
make venv
|
|
96
|
-
|
|
97
|
-
or, for a specific Python version
|
|
93
|
+
Install uv from https://docs.astral.sh/uv/ and then run
|
|
98
94
|
|
|
99
|
-
|
|
95
|
+
uv sync
|
|
@@ -8,8 +8,9 @@ Dataiter's **`DataFrame`** is a class for tabular data similar to R's
|
|
|
8
8
|
is under the hood a dictionary of NumPy arrays and thus capable of fast
|
|
9
9
|
vectorized operations. You can consider it to be a light-weight
|
|
10
10
|
alternative to Pandas with a simple and consistent API. Performance-wise
|
|
11
|
-
Dataiter relies on NumPy and
|
|
12
|
-
|
|
11
|
+
Dataiter relies on NumPy and PyArrow and is close to the level of
|
|
12
|
+
Pandas. Currently the notable slow part is string data and operations
|
|
13
|
+
(Dataiter's NumPy StringDType being slower than Pandas' Arrow strings).
|
|
13
14
|
|
|
14
15
|
## Installation
|
|
15
16
|
|
|
@@ -19,18 +20,8 @@ pip install -U dataiter
|
|
|
19
20
|
|
|
20
21
|
# Latest development version
|
|
21
22
|
pip install -U git+https://github.com/otsaloma/dataiter
|
|
22
|
-
|
|
23
|
-
# Numba (optional)
|
|
24
|
-
pip install -U numba
|
|
25
23
|
```
|
|
26
24
|
|
|
27
|
-
Recommended NumPy version is currently >= 2.4.0 due to various
|
|
28
|
-
StringDType fixes that have landed in NumPy 2.2.1 and 2.4.0.
|
|
29
|
-
|
|
30
|
-
Dataiter optionally uses **Numba** to speed up certain operations. If
|
|
31
|
-
you have Numba installed, Dataiter will use it automatically. It's
|
|
32
|
-
currently not a hard dependency, so you need to install it separately.
|
|
33
|
-
|
|
34
25
|
## Quick Start
|
|
35
26
|
|
|
36
27
|
```python
|
|
@@ -64,20 +55,23 @@ the differences and similarities in common operations.
|
|
|
64
55
|
|
|
65
56
|
https://dataiter.readthedocs.io/en/stable/comparison.html
|
|
66
57
|
|
|
67
|
-
For
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
### For Coding Agents
|
|
59
|
+
|
|
60
|
+
Dataiter's API is small enough that the complete documentation fits in
|
|
61
|
+
about 50k tokens. Coding agents can read all of it in one go and know
|
|
62
|
+
the whole API before writing any code. This differs from bigger
|
|
63
|
+
packages, like Pandas and Polars, which must fight against outdated
|
|
64
|
+
training data and introduce their huge API piecemeal, hoping the agent
|
|
65
|
+
knows what to ask for. For best results, have your agent download
|
|
66
|
+
`llms-full.txt` and read it in full, rather than fetch it with a tool
|
|
67
|
+
that summarizes web pages. Each documentation page is also available as
|
|
68
|
+
Markdown by replacing `.html` with `.md` in the URL.
|
|
70
69
|
|
|
71
|
-
- https://dataiter.readthedocs.io/en/stable/data-frame.md
|
|
72
|
-
- https://dataiter.readthedocs.io/en/stable/llms.txt
|
|
73
70
|
- https://dataiter.readthedocs.io/en/stable/llms-full.txt
|
|
71
|
+
- https://dataiter.readthedocs.io/en/stable/data-frame.md
|
|
74
72
|
|
|
75
73
|
## Development
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
make venv
|
|
80
|
-
|
|
81
|
-
or, for a specific Python version
|
|
75
|
+
Install uv from https://docs.astral.sh/uv/ and then run
|
|
82
76
|
|
|
83
|
-
|
|
77
|
+
uv sync
|
|
@@ -20,20 +20,32 @@
|
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
21
|
# THE SOFTWARE.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
import numpy as np
|
|
25
|
-
|
|
26
|
-
from dataiter import util
|
|
27
|
-
|
|
28
|
-
__version__ = "1.4"
|
|
23
|
+
__version__ = "2.0"
|
|
29
24
|
|
|
25
|
+
#: Default amount of elements to return from :meth:`Vector.head`,
|
|
26
|
+
#: :meth:`Vector.sample` and :meth:`Vector.tail`.
|
|
30
27
|
DEFAULT_PEEK_ELEMENTS = 10
|
|
28
|
+
|
|
29
|
+
#: Default amount of items to return from :meth:`ListOfDicts.head`,
|
|
30
|
+
#: :meth:`ListOfDicts.sample` and :meth:`ListOfDicts.tail`.
|
|
31
31
|
DEFAULT_PEEK_ITEMS = 3
|
|
32
|
+
|
|
33
|
+
#: Default amount of rows to return from :meth:`DataFrame.head`,
|
|
34
|
+
#: :meth:`DataFrame.sample` and :meth:`DataFrame.tail`.
|
|
32
35
|
DEFAULT_PEEK_ROWS = 10
|
|
36
|
+
|
|
37
|
+
#: Amount of significant digits to print floats with, all values of a
|
|
38
|
+
#: column or vector using the decimals that the largest value gets.
|
|
33
39
|
PRINT_FLOAT_PRECISION = 6
|
|
40
|
+
|
|
41
|
+
#: Maximum amount of elements to show when printing a :class:`Vector`.
|
|
34
42
|
PRINT_MAX_ELEMENTS = 100
|
|
43
|
+
|
|
44
|
+
#: Maximum amount of items to show when printing a :class:`ListOfDicts`.
|
|
35
45
|
PRINT_MAX_ITEMS = 10
|
|
36
|
-
|
|
46
|
+
|
|
47
|
+
#: Maximum amount of rows to show when printing a :class:`DataFrame`.
|
|
48
|
+
PRINT_MAX_ROWS = 20
|
|
37
49
|
|
|
38
50
|
#: Maximum amount of columns to wrap print output to. This is only a fallback
|
|
39
51
|
#: in case Python's ``shutil.get_terminal_size`` fails to detect the width of
|
|
@@ -49,46 +61,9 @@ PRINT_THOUSAND_SEPARATOR = ""
|
|
|
49
61
|
#: rendered at the cut point.
|
|
50
62
|
PRINT_TRUNCATE_WIDTH = 36
|
|
51
63
|
|
|
52
|
-
#: ``True`` to use Numba, if available, to speed up :doc:`aggregations
|
|
53
|
-
#: </aggregation>`, ``False`` to only use pure Python code.
|
|
54
|
-
USE_NUMBA = False
|
|
55
|
-
|
|
56
|
-
#: ``True`` to use Numba cache for JIT-compiled :doc:`aggregations
|
|
57
|
-
#: </aggregation>`, ``False`` to only keep compiled code in memory for the
|
|
58
|
-
#: duration of the session.
|
|
59
|
-
USE_NUMBA_CACHE = True
|
|
60
|
-
|
|
61
|
-
if not np.__version__.startswith("2."):
|
|
62
|
-
raise Exception("NumPy 2.x required")
|
|
63
|
-
|
|
64
|
-
with contextlib.suppress(LookupError):
|
|
65
|
-
USE_NUMBA_CACHE = util.parse_env_boolean("DATAITER_USE_NUMBA_CACHE")
|
|
66
|
-
|
|
67
|
-
try:
|
|
68
|
-
# Force Numba on or off if environment variable defined.
|
|
69
|
-
USE_NUMBA = util.parse_env_boolean("DATAITER_USE_NUMBA")
|
|
70
|
-
except LookupError:
|
|
71
|
-
with contextlib.suppress(Exception):
|
|
72
|
-
# Use Numba automatically if found
|
|
73
|
-
# and calling a trivial function works.
|
|
74
|
-
import numba
|
|
75
|
-
try:
|
|
76
|
-
@numba.njit(cache=USE_NUMBA_CACHE)
|
|
77
|
-
def check(x):
|
|
78
|
-
return x**2
|
|
79
|
-
assert check(10) == 100
|
|
80
|
-
USE_NUMBA = True
|
|
81
|
-
except Exception as error:
|
|
82
|
-
print(f"Numba found, but disabled due to error: {error!s}")
|
|
83
|
-
|
|
84
|
-
globals().pop("check", None)
|
|
85
|
-
globals().pop("contextlib", None)
|
|
86
|
-
globals().pop("np", None)
|
|
87
|
-
globals().pop("numba", None)
|
|
88
|
-
globals().pop("util", None)
|
|
89
|
-
|
|
90
64
|
from dataiter import dtypes
|
|
91
65
|
from dataiter.vector import Vector
|
|
66
|
+
from dataiter.vector import of_type
|
|
92
67
|
from dataiter.data_frame import DataFrame
|
|
93
68
|
from dataiter.data_frame import DataFrameColumn
|
|
94
69
|
from dataiter.geojson import GeoJSON
|
|
@@ -108,6 +83,7 @@ from dataiter.aggregate import median
|
|
|
108
83
|
from dataiter.aggregate import min
|
|
109
84
|
from dataiter.aggregate import mode
|
|
110
85
|
from dataiter.aggregate import nth
|
|
86
|
+
from dataiter.aggregate import prod
|
|
111
87
|
from dataiter.aggregate import quantile
|
|
112
88
|
from dataiter.aggregate import std
|
|
113
89
|
from dataiter.aggregate import sum
|
|
@@ -116,5 +92,18 @@ from dataiter.aggregate import var
|
|
|
116
92
|
from dataiter.io import read_csv
|
|
117
93
|
from dataiter.io import read_geojson
|
|
118
94
|
from dataiter.io import read_json
|
|
95
|
+
from dataiter.io import read_jsonl
|
|
119
96
|
from dataiter.io import read_npz
|
|
120
97
|
from dataiter.io import read_parquet
|
|
98
|
+
|
|
99
|
+
from dataiter import util
|
|
100
|
+
|
|
101
|
+
#: Special value to refer to the next element/item.
|
|
102
|
+
#: Used by ``replace_na`` to replace missing values with
|
|
103
|
+
#: the next non-missing value, i.e. to fill backward.
|
|
104
|
+
NEXT = util.Sentinel("NEXT")
|
|
105
|
+
|
|
106
|
+
#: Special value to refer to the previous element/item.
|
|
107
|
+
#: Used by ``replace_na`` to replace missing values with
|
|
108
|
+
#: the previous non-missing value, i.e. to fill forward.
|
|
109
|
+
PREVIOUS = util.Sentinel("PREVIOUS")
|