dataiter 1.3.1__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.
Files changed (37) hide show
  1. {dataiter-1.3.1 → dataiter-2.0}/.gitignore +4 -6
  2. {dataiter-1.3.1 → dataiter-2.0}/PKG-INFO +29 -26
  3. {dataiter-1.3.1 → dataiter-2.0}/README.md +20 -19
  4. dataiter-2.0/dataiter/__init__.py +109 -0
  5. dataiter-2.0/dataiter/aggregate.py +586 -0
  6. dataiter-2.0/dataiter/data_frame.py +2216 -0
  7. {dataiter-1.3.1 → dataiter-2.0}/dataiter/deco.py +21 -0
  8. dataiter-2.0/dataiter/dt.py +508 -0
  9. {dataiter-1.3.1 → dataiter-2.0}/dataiter/dtypes.py +0 -8
  10. {dataiter-1.3.1 → dataiter-2.0}/dataiter/geojson.py +33 -21
  11. {dataiter-1.3.1 → dataiter-2.0}/dataiter/io.py +21 -10
  12. {dataiter-1.3.1 → dataiter-2.0}/dataiter/list_of_dicts.py +407 -146
  13. {dataiter-1.3.1 → dataiter-2.0}/dataiter/regex.py +68 -47
  14. {dataiter-1.3.1 → dataiter-2.0}/dataiter/test/test_aggregate.py +205 -47
  15. dataiter-2.0/dataiter/test/test_data_frame.py +1817 -0
  16. dataiter-2.0/dataiter/test/test_dt.py +398 -0
  17. {dataiter-1.3.1 → dataiter-2.0}/dataiter/test/test_geojson.py +39 -9
  18. {dataiter-1.3.1 → dataiter-2.0}/dataiter/test/test_io.py +5 -0
  19. {dataiter-1.3.1 → dataiter-2.0}/dataiter/test/test_list_of_dicts.py +412 -30
  20. {dataiter-1.3.1 → dataiter-2.0}/dataiter/test/test_regex.py +24 -0
  21. {dataiter-1.3.1 → dataiter-2.0}/dataiter/test/test_util.py +45 -20
  22. {dataiter-1.3.1 → dataiter-2.0}/dataiter/test/test_vector.py +416 -4
  23. dataiter-2.0/dataiter/util.py +290 -0
  24. dataiter-2.0/dataiter/vector.py +1277 -0
  25. dataiter-2.0/pyproject.toml +35 -0
  26. dataiter-1.3.1/dataiter/__init__.py +0 -120
  27. dataiter-1.3.1/dataiter/aggregate.py +0 -662
  28. dataiter-1.3.1/dataiter/data_frame.py +0 -1396
  29. dataiter-1.3.1/dataiter/dt.py +0 -291
  30. dataiter-1.3.1/dataiter/test/test_data_frame.py +0 -843
  31. dataiter-1.3.1/dataiter/test/test_dt.py +0 -174
  32. dataiter-1.3.1/dataiter/util.py +0 -170
  33. dataiter-1.3.1/dataiter/vector.py +0 -855
  34. dataiter-1.3.1/pyproject.toml +0 -22
  35. {dataiter-1.3.1 → dataiter-2.0}/AUTHORS.md +0 -0
  36. {dataiter-1.3.1 → dataiter-2.0}/COPYING +0 -0
  37. {dataiter-1.3.1 → dataiter-2.0}/dataiter/test/__init__.py +0 -0
@@ -1,19 +1,17 @@
1
- *.lprof
2
- *.prof
3
- .claude
1
+ .claude/settings.local.json
4
2
  .env
5
3
  .envrc
6
4
  .pytest_cache
5
+ .venv
7
6
  __pycache__
8
- benchmark-head.py
9
7
  benchmark-versions.csv
10
8
  benchmark-versions.ods
11
9
  build
12
- dataiter.egg-info
13
10
  dist
14
11
  doc/_build
15
12
  doc/comparison/comparison.html
16
13
  test.py
14
+ tmp
17
15
  tmp.csv
16
+ uv.lock
18
17
  validation/*.csv
19
- venv
@@ -1,21 +1,22 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.5
2
2
  Name: dataiter
3
- Version: 1.3.1
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
- License: MIT
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>=2.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
- Simple, Light-Weight Data Frames for Python
18
- ===========================================
19
+ # Simple, Light-Weight Data Frames for Python
19
20
 
20
21
  [![PyPI](https://img.shields.io/pypi/v/dataiter.svg)](https://pypi.org/project/dataiter)
21
22
  [![Downloads](https://pepy.tech/badge/dataiter/month)](https://pepy.tech/project/dataiter)
@@ -25,8 +26,9 @@ Dataiter's **`DataFrame`** is a class for tabular data similar to R's
25
26
  is under the hood a dictionary of NumPy arrays and thus capable of fast
26
27
  vectorized operations. You can consider it to be a light-weight
27
28
  alternative to Pandas with a simple and consistent API. Performance-wise
28
- Dataiter relies on NumPy and Numba and is likely to be at best
29
- 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).
30
32
 
31
33
  ## Installation
32
34
 
@@ -36,18 +38,8 @@ pip install -U dataiter
36
38
 
37
39
  # Latest development version
38
40
  pip install -U git+https://github.com/otsaloma/dataiter
39
-
40
- # Numba (optional)
41
- pip install -U numba
42
41
  ```
43
42
 
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
-
47
- Dataiter optionally uses **Numba** to speed up certain operations. If
48
- you have Numba installed, Dataiter will use it automatically. It's
49
- currently not a hard dependency, so you need to install it separately.
50
-
51
43
  ## Quick Start
52
44
 
53
45
  ```python
@@ -81,12 +73,23 @@ the differences and similarities in common operations.
81
73
 
82
74
  https://dataiter.readthedocs.io/en/stable/comparison.html
83
75
 
84
- ## Development
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.
85
87
 
86
- To install a virtualenv for development, use
88
+ - https://dataiter.readthedocs.io/en/stable/llms-full.txt
89
+ - https://dataiter.readthedocs.io/en/stable/data-frame.md
87
90
 
88
- make venv
91
+ ## Development
89
92
 
90
- or, for a specific Python version
93
+ Install uv from https://docs.astral.sh/uv/ and then run
91
94
 
92
- make PYTHON=python3.X venv
95
+ uv sync
@@ -1,5 +1,4 @@
1
- Simple, Light-Weight Data Frames for Python
2
- ===========================================
1
+ # Simple, Light-Weight Data Frames for Python
3
2
 
4
3
  [![PyPI](https://img.shields.io/pypi/v/dataiter.svg)](https://pypi.org/project/dataiter)
5
4
  [![Downloads](https://pepy.tech/badge/dataiter/month)](https://pepy.tech/project/dataiter)
@@ -9,8 +8,9 @@ Dataiter's **`DataFrame`** is a class for tabular data similar to R's
9
8
  is under the hood a dictionary of NumPy arrays and thus capable of fast
10
9
  vectorized operations. You can consider it to be a light-weight
11
10
  alternative to Pandas with a simple and consistent API. Performance-wise
12
- Dataiter relies on NumPy and Numba and is likely to be at best
13
- 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).
14
14
 
15
15
  ## Installation
16
16
 
@@ -20,18 +20,8 @@ pip install -U dataiter
20
20
 
21
21
  # Latest development version
22
22
  pip install -U git+https://github.com/otsaloma/dataiter
23
-
24
- # Numba (optional)
25
- pip install -U numba
26
23
  ```
27
24
 
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
-
31
- Dataiter optionally uses **Numba** to speed up certain operations. If
32
- you have Numba installed, Dataiter will use it automatically. It's
33
- currently not a hard dependency, so you need to install it separately.
34
-
35
25
  ## Quick Start
36
26
 
37
27
  ```python
@@ -65,12 +55,23 @@ the differences and similarities in common operations.
65
55
 
66
56
  https://dataiter.readthedocs.io/en/stable/comparison.html
67
57
 
68
- ## Development
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.
69
69
 
70
- To install a virtualenv for development, use
70
+ - https://dataiter.readthedocs.io/en/stable/llms-full.txt
71
+ - https://dataiter.readthedocs.io/en/stable/data-frame.md
71
72
 
72
- make venv
73
+ ## Development
73
74
 
74
- or, for a specific Python version
75
+ Install uv from https://docs.astral.sh/uv/ and then run
75
76
 
76
- make PYTHON=python3.X venv
77
+ uv sync
@@ -0,0 +1,109 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # Copyright (c) 2020 Osmo Salomaa
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ __version__ = "2.0"
24
+
25
+ #: Default amount of elements to return from :meth:`Vector.head`,
26
+ #: :meth:`Vector.sample` and :meth:`Vector.tail`.
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
+ DEFAULT_PEEK_ITEMS = 3
32
+
33
+ #: Default amount of rows to return from :meth:`DataFrame.head`,
34
+ #: :meth:`DataFrame.sample` and :meth:`DataFrame.tail`.
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.
39
+ PRINT_FLOAT_PRECISION = 6
40
+
41
+ #: Maximum amount of elements to show when printing a :class:`Vector`.
42
+ PRINT_MAX_ELEMENTS = 100
43
+
44
+ #: Maximum amount of items to show when printing a :class:`ListOfDicts`.
45
+ PRINT_MAX_ITEMS = 10
46
+
47
+ #: Maximum amount of rows to show when printing a :class:`DataFrame`.
48
+ PRINT_MAX_ROWS = 20
49
+
50
+ #: Maximum amount of columns to wrap print output to. This is only a fallback
51
+ #: in case Python's ``shutil.get_terminal_size`` fails to detect the width of
52
+ #: your terminal. By default the detected full width is used.
53
+ PRINT_MAX_WIDTH = 80
54
+
55
+ #: Thousand separator to use when printing numbers. By default this is blank,
56
+ #: meaning no thousand separators are rendered.
57
+ PRINT_THOUSAND_SEPARATOR = ""
58
+
59
+ #: Maximum width to truncate string columns to in :class:`DataFrame` print
60
+ #: output. When this is exceeded, strings will be cut and an ellipsis (``…``)
61
+ #: rendered at the cut point.
62
+ PRINT_TRUNCATE_WIDTH = 36
63
+
64
+ from dataiter import dtypes
65
+ from dataiter.vector import Vector
66
+ from dataiter.vector import of_type
67
+ from dataiter.data_frame import DataFrame
68
+ from dataiter.data_frame import DataFrameColumn
69
+ from dataiter.geojson import GeoJSON
70
+ from dataiter.list_of_dicts import ListOfDicts
71
+ from dataiter import dt
72
+ from dataiter import regex
73
+
74
+ from dataiter.aggregate import all
75
+ from dataiter.aggregate import any
76
+ from dataiter.aggregate import count
77
+ from dataiter.aggregate import count_unique
78
+ from dataiter.aggregate import first
79
+ from dataiter.aggregate import last
80
+ from dataiter.aggregate import max
81
+ from dataiter.aggregate import mean
82
+ from dataiter.aggregate import median
83
+ from dataiter.aggregate import min
84
+ from dataiter.aggregate import mode
85
+ from dataiter.aggregate import nth
86
+ from dataiter.aggregate import prod
87
+ from dataiter.aggregate import quantile
88
+ from dataiter.aggregate import std
89
+ from dataiter.aggregate import sum
90
+ from dataiter.aggregate import var
91
+
92
+ from dataiter.io import read_csv
93
+ from dataiter.io import read_geojson
94
+ from dataiter.io import read_json
95
+ from dataiter.io import read_jsonl
96
+ from dataiter.io import read_npz
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")