Skip to content
Snippets Groups Projects
Commit 8d022953 authored by Bert Palm's avatar Bert Palm 🎇
Browse files

fixed stuff, conf.py, index.rst

parent 9b5ba266
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,7 @@ extensions = [ ...@@ -50,6 +50,7 @@ extensions = [
# markdown sources support # markdown sources support
'recommonmark', 'recommonmark',
'sphinx_markdown_tables',
] ]
numpydoc_show_class_members = False numpydoc_show_class_members = False
automodsumm_inherited_members = True automodsumm_inherited_members = True
......
...@@ -22,14 +22,16 @@ each column separately. ...@@ -22,14 +22,16 @@ each column separately.
So maybe a first example gives an rough idea: So maybe a first example gives an rough idea:
``` ```
>> d >>> s = pd.Series([11] * 4 )
>>> d = DictOfSeries(dict(a=s[:2]*6, b=s[2:4]*7, c=s[:2]*8, d=s[1:3]*9))
>>> d
a | b | c | d | a | b | c | d |
===== | ===== | ===== | ===== | ===== | ===== | ===== | ===== |
0 66 | 2 77 | 0 88 | 1 99 | 0 66 | 2 77 | 0 88 | 1 99 |
1 66 | 3 77 | 1 88 | 2 99 | 1 66 | 3 77 | 1 88 | 2 99 |
>> d.aloc[[1,2], ['a', 'b', 'd', 'x']] >>> d.aloc[[1,2], ['a', 'b', 'd', 'x']]
a | b | d | a | b | d |
===== | ===== | ===== | ===== | ===== | ===== |
1 66 | 2 77 | 1 99 | 1 66 | 2 77 | 1 99 |
...@@ -94,37 +96,44 @@ Indexer Table ...@@ -94,37 +96,44 @@ Indexer Table
| example | type | on | like `.loc` | handling | conditions / hints | link | | example | type | on | like `.loc` | handling | conditions / hints | link |
| ------- | ---- | --- | ----------- | -------- | ------------------ | ---- | | ------- | ---- | --- | ----------- | -------- | ------------------ | ---- |
| `.aloc[any, 'a']` | scalar | columns |no | select graceful | - | [cols](#select-columns-gracefully)| | `.aloc[any, 'a']` | scalar | columns |no | select graceful | - | [cols](#select-columns-gracefully)|
|[Column indexer](#select-columns-gracefully)|
fooo
----
|[Column indexer](#select-columns-gracefully)| ---- | --- | ----------- | -------- | ------------------ | ---- |
| `.aloc[any, 'a']` | scalar | columns |no | select graceful | - | [cols](#select-columns-gracefully)| | `.aloc[any, 'a']` | scalar | columns |no | select graceful | - | [cols](#select-columns-gracefully)|
| `.aloc[any, 'b':'z']` | slice | columns |yes| slice | - | [cols](#select-columns-gracefully)| | `.aloc[any, 'b':'z']` | slice | columns |yes| slice | - | [cols](#select-columns-gracefully)|
| `.aloc[any, ['a','c']]` | list-like | columns |no | filter graceful | - | [cols](#select-columns-gracefully)| | `.aloc[any, ['a','c']]` | list-like | columns |no | filter graceful | - | [cols](#select-columns-gracefully)|
| `.aloc[any [True,False]]` | bool list-like | columns |yes| take `True`'s | length must match nr of columns | [cols](#select-columns-gracefully)| | `.aloc[any [True,False]]` | bool list-like | columns |yes| take `True`'s | length must match nr of columns | [cols](#select-columns-gracefully)|
| `.aloc[any, s]` | pandas.Series | columns |no | like list, | only `s.values` are evaluated | [cols](#select-columns-gracefully)| | `.aloc[any, s]` | Series | columns |no | like list, | only `s.values` are evaluated | [cols](#select-columns-gracefully)|
| `.aloc[any, bs]` | bool pandas.Series | columns |yes| like bool-list | see there | [cols](#select-columns-gracefully)| | `.aloc[any, bs]` | bool Series | columns |yes| like bool-list | see there | [cols](#select-columns-gracefully)|
|[Row indexer](#selecting-rows-a-smart-way)| ---- | --- | ----------- | -------- | ------------------ | ---- | |[Row indexer](#selecting-rows-a-smart-way)|
| `.aloc[7, any]` | scalar | rows |no | translate to `.loc[key:key]` | - | [rows](#selecting-rows-a-smart-way) | | `.aloc[7, any]` | scalar | rows |no | translate to `.loc[key:key]` | - | [rows](#selecting-rows-a-smart-way) |
| `.aloc[3:42, any]` | slice | rows |yes| slice | - | | | `.aloc[3:42, any]` | slice | rows |yes| slice | - | |
| `.aloc[[1,2,24], any]` | list-like | rows |no | filter graceful | - | [rows](#selecting-rows-a-smart-way) | | `.aloc[[1,2,24], any]` | list-like | rows |no | filter graceful | - | [rows](#selecting-rows-a-smart-way) |
| `.aloc[[True,False], any]` | bool list-like | rows |yes| take `True`'s | length must match nr of (all selected) columns | [blist](#boolean-array-likes-as-row-indexer)| | `.aloc[[True,False], any]` | bool list-like | rows |yes| take `True`'s | length must match nr of (all selected) columns | [blist](#boolean-array-likes-as-row-indexer)|
| `.aloc[s, any]` | pandas.Series | rows |no | like `.loc[s.index]` | - | [ser](#pandasseries-and-boolean-pandasseries-as-row-indexer) | | `.aloc[s, any]` | Series | rows |no | like `.loc[s.index]` | - | [ser](#pandasseries-and-boolean-pandasseries-as-row-indexer) |
| `.aloc[bs, any]` | bool pandas.Series | rows |no | align + just take `True`'s | evaluate `usebool`-keyword | [ser](#pandasseries-and-boolean-pandasseries-as-row-indexer)| | `.aloc[bs, any]` | bool Series | rows |no | align + just take `True`'s | evaluate `usebool`-keyword | [ser](#pandasseries-and-boolean-pandasseries-as-row-indexer)|
| `.aloc[[[s],[1,2,3]], any]` | nested list-like | both | ? | one row-indexer per column | outer length must match nr of (selected) columns | [nlist](#nested-lists-as-row-indexer) | | `.aloc[[[s],[1,2,3]], any]` | nested list-like | both | ? | one row-indexer per column | outer length must match nr of (selected) columns | [nlist](#nested-lists-as-row-indexer) |
|[2D-indexer](#the-power-of-2d-indexer)| ---- | --- | ----------- | -------- | ------------------ | ---- | |[2D-indexer](#the-power-of-2d-indexer)|
| `.aloc[di]` | dios-like | both |no | full align | - | | | `.aloc[di]` | dios-like | both |no | full align | - | |
| `.aloc[di, ...]` | dios-like | both |no | full align | ellipsis has no effect | | | `.aloc[di, ...]` | dios-like | both |no | full align | ellipsis has no effect | |
| `.aloc[di>5]` | bool dios-like | both |no | full align + take `True`'s | evaluate `usebool`-keyword | | | `.aloc[di>5]` | bool dios-like | both |no | full align + take `True`'s | evaluate `usebool`-keyword | |
| `.aloc[di>5, ...]` | (bool) dios-like | both |no | full align, **no** bool evaluation | - | | | `.aloc[di>5, ...]` | (bool) dios-like | both |no | full align, **no** bool evaluation | - | |
Example dios Example dios
============ ------------
The dios used in the examples, unless stated otherwise: The dios used in the examples, unless stated otherwise:
``` ```
# generate dict
>>> sa = pd.Series(range(0, 70, 7))
>>> sb = pd.Series(range(5, 15, 1))
>>> sc = pd.Series(range(7, 107, 10))
>>> sd = pd.Series(range(0, 10, 1))
>>> for i, s in enumerate([sa,sb,sc,sd]): s.index += i*2
>>> d = DictOfSeries(dict(a=sa, b=sb, c=sc, d=sd))[:5]
```
Looks like so:
```
>>> d >>> d
a | b | c | d | a | b | c | d |
===== | ==== | ===== | ===== | ===== | ==== | ===== | ===== |
...@@ -136,13 +145,13 @@ The dios used in the examples, unless stated otherwise: ...@@ -136,13 +145,13 @@ The dios used in the examples, unless stated otherwise:
``` ```
Select columns, gracefully Select columns, gracefully
=========================== ---------------------------
**Single columns** **Single columns**
Use `.aloc[:, key]` to select a single column gracefully. Use `.aloc[:, key]` to select a single column gracefully.
The underling pandas Series is returned, if the key exist. The underling pandas.Series is returned, if the key exist.
Otherwise a empty pd.Series with `dtype=object` is returned. Otherwise a empty pandas.Series with `dtype=object` is returned.
``` ```
>>> d.aloc[:, 'a'] >>> d.aloc[:, 'a']
...@@ -207,7 +216,7 @@ eg `.loc[:, 'a':'f']`. ...@@ -207,7 +216,7 @@ eg `.loc[:, 'a':'f']`.
Selecting Rows a smart way Selecting Rows a smart way
========================== --------------------------
For scalar and array-like indexer with label values, the keys are handled gracefully, just like with For scalar and array-like indexer with label values, the keys are handled gracefully, just like with
array-like column indexers. array-like column indexers.
...@@ -255,8 +264,7 @@ If the length does not match a `IndexError` is raised: ...@@ -255,8 +264,7 @@ If the length does not match a `IndexError` is raised:
>>> d.aloc[[True,False,False]] >>> d.aloc[[True,False,False]]
Traceback (most recent call last): Traceback (most recent call last):
... ...
f"Boolean index has wrong length: " IndexError: failed for column a: Boolean index has wrong length: 3 instead of 5
IndexError: failed for column a: Boolean index has wrong length: 3 instead of 5
``` ```
This can be tricky, especially if columns have different length: This can be tricky, especially if columns have different length:
...@@ -271,8 +279,7 @@ This can be tricky, especially if columns have different length: ...@@ -271,8 +279,7 @@ This can be tricky, especially if columns have different length:
>>> difflen.aloc[[False,True,False]] >>> difflen.aloc[[False,True,False]]
Traceback (most recent call last): Traceback (most recent call last):
... ...
f"Boolean index has wrong length: " IndexError: Boolean index has wrong length: 3 instead of 2
IndexError: Boolean index has wrong length: 3 instead of 2
``` ```
pandas.Series and boolean pandas.Series as row indexer pandas.Series and boolean pandas.Series as row indexer
...@@ -401,7 +408,7 @@ In contrast to the 2D-indexer, we also can provide a column key, to pre-filter t ...@@ -401,7 +408,7 @@ In contrast to the 2D-indexer, we also can provide a column key, to pre-filter t
The power of 2D-indexer The power of 2D-indexer
======================= -----------------------
Overview: Overview:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment