Skip to content

Commit c1d28ac

Browse files
committed
Add details on Table object from pandas blog
1 parent 5472db8 commit c1d28ac

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

ROADMAP-TO-4.0.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,26 @@ The constructor for the `Table` object should take some parameters to specify pr
2121
* `.__iter__()` for easy and fast iteration over rows.
2222
* `.where()`: an iterator for querying with conditions that are evaluated with the internal compute engine.
2323
* `.index()` for indexing a column and getting better performance in queries (desirable, but optional for 4.0).
24+
25+
In particular, it should try to mimic much of the functionality of data-querying libraries such as ``pandas`` (see [this blog](https://datapythonista.me/blog/whats-new-in-pandas-3) for much of the followin). Hence, one should be able to filter rows of the `Table` via querying on multiple columns (accessed via `.` or perhaps ``__getitem__``), with conditions to select rows implemented via `.index`, `.where` like so
26+
27+
```
28+
tbl.where((tbl.property_type == "hotel") & (tbl.country == "us"))
29+
```
30+
31+
It should also be possible to modify the filtered ``Table`` in-place, using some operation which only acts on the filtered elements (e.g ``assign``)
32+
33+
```
34+
tbl = tbl.where((tbl.property_type == "hotel") & (tbl.country == "us")).assign(max_people = tbl.max_people + tbl.max_children)
35+
```
36+
37+
Secondly, it should be possible to write bespoke transformation functions which act row-wise and then may be applied to get results from the `Table` and/or modify the ``Table`` in-place:
38+
39+
```
40+
def myudf(row):
41+
col = row.name_of_column
42+
# do things with col
43+
return result
44+
45+
ans = tbl.apply(myudf, axis=1)
46+
```

examples/ndarray/string_arrays.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@
131131
"source": [
132132
"for t in (\"bytes\", \"string\"):\n",
133133
" if t == \"bytes\":\n",
134-
" a1 = np.array([b\"abc\", b\"def\", b\"aterr\", b\"oot\", b\"zu\", b\"ab c\"])\n",
134+
" a1 = np.array([b\"abc\", b\"def\", b\"atErr\", b\"oot\", b\"zu\", b\"ab c\"])\n",
135135
" a2 = a2_blosc = b\"a\"\n",
136136
" else:\n",
137-
" a1 = np.array([\"abc\", \"def\", \"aterr\", \"oot\", \"zu\", \"ab c\"])\n",
137+
" a1 = np.array([\"abc\", \"def\", \"atErr\", \"oot\", \"zu\", \"ab c\"])\n",
138138
" a2 = a2_blosc = \"a\"\n",
139139
" a1_blosc = blosc2.asarray(a1)\n",
140140
" for func, npfunc in zip(\n",

0 commit comments

Comments
 (0)