Skip to content

Commit 72652f2

Browse files
timofey-stepanovcopybara-github
authored andcommitted
Move koda_v1_api_reference to api_reference.
PiperOrigin-RevId: 718293671 Change-Id: I24bf9168fe8c5c2f894ac8ccb9fc826668cded7a
1 parent 007302d commit 72652f2

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

docs/_data/navigation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ items:
88
- title: "Cheatsheet"
99
url: "cheatsheet.html"
1010
- title: "API Reference"
11-
url: "koda_v1_api_reference.html"
11+
url: "api_reference.html"
Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ Example:
16751675
kd.call(kd.fn(I.x + I.y), x=2, y=3)
16761676
# returns kd.item(5)
16771677
1678-
kde.call(I.fn, x=2, y=3).eval(fn=kd.fn(I.x + I.y))
1678+
kd.lazy.call(I.fn, x=2, y=3).eval(fn=kd.fn(I.x + I.y))
16791679
# returns kd.item(5)
16801680
16811681
Args:
@@ -5957,11 +5957,16 @@ slicing argument can be one of the following:
59575957
1) INT32/INT64 DataItem or Python integer wrapped into INT32 DataItem. It is
59585958
used to select a single item in one dimension. It reduces the number of
59595959
dimensions in the resulting DataSlice by 1.
5960-
2) INT32/INT64 DataSlice or Python nested list of integer wrapped into INT32
5961-
DataSlice. It is used to select multiple items in one dimension.
5960+
2) INT32/INT64 DataSlice. It is used to select multiple items in one
5961+
dimension.
59625962
3) Python slice (e.g. slice(1), slice(1, 3), slice(2, -1)). It is used to
59635963
select a slice of items in one dimension. 'step' is not supported and it
5964-
results in no item if 'start' is larger than or equal to 'stop'.
5964+
results in no item if 'start' is larger than or equal to 'stop'. 'start'
5965+
and 'stop' can be either Python integers, DataItems or DataSlices, in
5966+
the latter case we can select a different range for different items,
5967+
or even select multiple ranges for the same item if the 'start'
5968+
or 'stop' have more dimensions. If an item is missing either in 'start'
5969+
or in 'stop', the corresponding slice is considered empty.
59655970
4) .../Ellipsis. It can appear at most once in `slices` and used to fill
59665971
corresponding dimensions in `x` but missing in `slices`. It means
59675972
selecting all items in these dimensions.
@@ -6030,6 +6035,17 @@ Example 11:
60306035
kd.subslice(x, 1, 2, 3, 4)
60316036
=> error as at most 3 slicing arguments can be provided
60326037
6038+
Example 12:
6039+
x = kd.slice([[[1, 2], [3]], [[4, 5, 6]], [[7], [8, 9]]])
6040+
kd.subslice(x, slice(kd.slice([0, 1, 2]), None))
6041+
=> kd.slice([[[1, 2], [3]], [[5, 6]], [[], []]])
6042+
6043+
Example 13:
6044+
x = kd.slice([[[1, 2], [3]], [[4, 5, 6]], [[7], [8, 9]]])
6045+
kd.subslice(x, slice(kd.slice([0, 1, 2]), kd.slice([2, 3, None])), ...)
6046+
=> kd.slice([[[[1, 2], [3]], [[4, 5, 6]]], [[[4, 5, 6]], [[7], [8, 9]]],
6047+
[]])
6048+
60336049
Note that there is a shortcut `ds.S[*slices] for this operator which is more
60346050
commonly used and the Python slice can be written as [start:end] format. For
60356051
example:
@@ -6861,13 +6877,24 @@ Args:
68616877
range [0, len(x)).
68626878
```
68636879

6880+
### `kd.tuple.make_slice(start=unspecified, stop=unspecified, step=unspecified)` {#kd.tuple.make_slice}
6881+
6882+
``` {.no-copy}
6883+
Returns a slice for the Python indexing syntax foo[start:stop:step].
6884+
6885+
Args:
6886+
start: (optional) Indexing start.
6887+
stop: (optional) Indexing stop.
6888+
step: (optional) Indexing step size.
6889+
```
6890+
68646891
### `kd.tuple.make_tuple(*args)` {#kd.tuple.make_tuple}
68656892
Aliases:
68666893

68676894
- [kd.make_tuple](#kd.make_tuple)
68686895

68696896
``` {.no-copy}
6870-
Returns a tuple constructed from the given arguments.
6897+
Returns a tuple-like object containing the given `*args`.
68716898
```
68726899

68736900
</section>

docs/cheatsheet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ Sub-slicing slices **all** dimensions of a DataSlice or the last dimension when
446446
only one dimension is specified. The API is called "subslice" because it slices
447447
a DataSlice to create a sub-DataSlice.
448448

449-
See [kd.subslice](koda_v1_api_reference.md#kd.slices.subslice) APIs for more details.
449+
See [kd.subslice](api_reference.md#kd.slices.subslice) APIs for more details.
450450

451451
```py
452452
ds = kd.slice([[1, 2, 3], [4, 5]])

0 commit comments

Comments
 (0)