dataiter 1.4__tar.gz → 2.1__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 (37) hide show
  1. {dataiter-1.4 → dataiter-2.1}/.gitignore +3 -2
  2. {dataiter-1.4 → dataiter-2.1}/PKG-INFO +24 -28
  3. {dataiter-1.4 → dataiter-2.1}/README.md +17 -23
  4. {dataiter-1.4 → dataiter-2.1}/dataiter/__init__.py +42 -45
  5. dataiter-2.1/dataiter/aggregate.py +627 -0
  6. dataiter-2.1/dataiter/data_frame.py +2422 -0
  7. {dataiter-1.4 → dataiter-2.1}/dataiter/deco.py +30 -0
  8. dataiter-2.1/dataiter/dt.py +537 -0
  9. {dataiter-1.4 → dataiter-2.1}/dataiter/dtypes.py +0 -8
  10. {dataiter-1.4 → dataiter-2.1}/dataiter/geojson.py +33 -21
  11. {dataiter-1.4 → dataiter-2.1}/dataiter/io.py +29 -10
  12. {dataiter-1.4 → dataiter-2.1}/dataiter/list_of_dicts.py +409 -145
  13. {dataiter-1.4 → dataiter-2.1}/dataiter/regex.py +60 -15
  14. {dataiter-1.4 → dataiter-2.1}/dataiter/test/test_aggregate.py +224 -46
  15. dataiter-2.1/dataiter/test/test_data_frame.py +1994 -0
  16. dataiter-2.1/dataiter/test/test_dt.py +432 -0
  17. {dataiter-1.4 → dataiter-2.1}/dataiter/test/test_geojson.py +37 -5
  18. {dataiter-1.4 → dataiter-2.1}/dataiter/test/test_io.py +15 -0
  19. {dataiter-1.4 → dataiter-2.1}/dataiter/test/test_list_of_dicts.py +399 -16
  20. {dataiter-1.4 → dataiter-2.1}/dataiter/test/test_regex.py +24 -0
  21. {dataiter-1.4 → dataiter-2.1}/dataiter/test/test_util.py +48 -12
  22. {dataiter-1.4 → dataiter-2.1}/dataiter/test/test_vector.py +426 -5
  23. dataiter-2.1/dataiter/test/test_window.py +112 -0
  24. dataiter-2.1/dataiter/util.py +322 -0
  25. dataiter-2.1/dataiter/vector.py +1297 -0
  26. dataiter-2.1/dataiter/window.py +165 -0
  27. {dataiter-1.4 → dataiter-2.1}/pyproject.toml +16 -2
  28. dataiter-1.4/dataiter/aggregate.py +0 -661
  29. dataiter-1.4/dataiter/data_frame.py +0 -1365
  30. dataiter-1.4/dataiter/dt.py +0 -291
  31. dataiter-1.4/dataiter/test/test_data_frame.py +0 -844
  32. dataiter-1.4/dataiter/test/test_dt.py +0 -174
  33. dataiter-1.4/dataiter/util.py +0 -169
  34. dataiter-1.4/dataiter/vector.py +0 -864
  35. {dataiter-1.4 → dataiter-2.1}/AUTHORS.md +0 -0
  36. {dataiter-1.4 → dataiter-2.1}/COPYING +0 -0
  37. {dataiter-1.4 → dataiter-2.1}/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: 1.4
3
+ Version: 2.1
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.11.0
12
+ Requires-Python: >=3.12.0
11
13
  Requires-Dist: attd>=0.3
12
- Requires-Dist: numpy<3.0,>=2.4.0
13
- Requires-Dist: pyarrow>=16.0
14
- Requires-Dist: wcwidth>=0.1
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 Numba and is likely to be at best
28
- comparable to Pandas.
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 coding agents and LLMs, each documentation page is also available as
84
- Markdown by replacing `.html` with `.md` in the URL. There's also an
85
- `llms.txt` index and complete documentation as `llms-full.txt`. See
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
- To install a virtualenv for development, use
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
- make PYTHON=python3.X venv
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 Numba and is likely to be at best
12
- comparable to Pandas.
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 coding agents and LLMs, each documentation page is also available as
68
- Markdown by replacing `.html` with `.md` in the URL. There's also an
69
- `llms.txt` index and complete documentation as `llms-full.txt`. See
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
- To install a virtualenv for development, use
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
- make PYTHON=python3.X venv
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
- import contextlib
24
- import numpy as np
25
-
26
- from dataiter import util
27
-
28
- __version__ = "1.4"
23
+ __version__ = "2.1"
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
- PRINT_MAX_ROWS = 100
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,13 +83,35 @@ 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
114
90
  from dataiter.aggregate import var
115
91
 
92
+ from dataiter.window import cummax
93
+ from dataiter.window import cummin
94
+ from dataiter.window import cumsum
95
+ from dataiter.window import rank
96
+ from dataiter.window import shift
97
+
116
98
  from dataiter.io import read_csv
99
+ from dataiter.io import read_duckdb
117
100
  from dataiter.io import read_geojson
118
101
  from dataiter.io import read_json
102
+ from dataiter.io import read_jsonl
119
103
  from dataiter.io import read_npz
120
104
  from dataiter.io import read_parquet
105
+ from dataiter.io import read_parquet_chunked
106
+
107
+ from dataiter import util
108
+
109
+ #: Special value to refer to the next element/item.
110
+ #: Used by ``replace_na`` to replace missing values with
111
+ #: the next non-missing value, i.e. to fill backward.
112
+ NEXT = util.Sentinel("NEXT")
113
+
114
+ #: Special value to refer to the previous element/item.
115
+ #: Used by ``replace_na`` to replace missing values with
116
+ #: the previous non-missing value, i.e. to fill forward.
117
+ PREVIOUS = util.Sentinel("PREVIOUS")