Skip to content

Commit

Permalink
docs for v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
endremborza committed Oct 9, 2021
1 parent 74178a7 commit 1dd2fca
Show file tree
Hide file tree
Showing 9 changed files with 635 additions and 21 deletions.
7 changes: 7 additions & 0 deletions docs/api/colassigner.ChildColAssigner.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ChildColAssigner
================

.. currentmodule:: colassigner

.. autoclass:: ChildColAssigner
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/api/colassigner.get_all_cols.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
get_all_cols
============

.. currentmodule:: colassigner

.. autofunction:: get_all_cols
6 changes: 6 additions & 0 deletions docs/api/colassigner.get_att_value.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
get_att_value
=============

.. currentmodule:: colassigner

.. autofunction:: get_att_value
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Welcome to colassigner's documentation!

notebooks/doc-000-intro
notebooks/doc-001-quickstart
notebooks/doc-003-drawing
notebooks/doc-002-nested-structures
autosumm
release_notes/main

Expand Down
9 changes: 4 additions & 5 deletions docs/notebooks/doc-000-intro.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
colassigner helps with fitting somewhat complex, nested
datastructures into tables, and removes the need to remember the name
of any column, if you can rely on static analysis

Installation:
=============

using pip
---------

``pip install colassigner``

whatever other thing level 3 header
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lorem ipsum temple repo
135 changes: 120 additions & 15 deletions docs/notebooks/doc-001-quickstart.rst
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
Quickstart
==========

.. code:: ipython3
import pandas as pd
Assign Columns
--------------

.. code:: ipython3
import pandas as pd
from colassigner import ColAssigner
.. code:: ipython3
class Cols1(ColAssigner):
def var1(self, df):
return df.iloc[:,0].mean()
def var2(self, df):
class Cols(ColAssigner):
def col1(self, df):
return df.iloc[:, 0] * 2
def col2(self, df):
return "added-another"
.. code:: ipython3
df = pd.DataFrame({"a": [1,2,3]}).assign(**Cols1())
df = pd.DataFrame({"a": [1, 2, 3]}).pipe(Cols())
.. code:: ipython3
Expand Down Expand Up @@ -51,31 +51,136 @@ Quickstart
<tr style="text-align: right;">
<th></th>
<th>a</th>
<th>var1</th>
<th>var2</th>
<th>col_1</th>
<th>col_2</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>1</td>
<td>2.0</td>
<td>2</td>
<td>added-another</td>
</tr>
<tr>
<th>1</th>
<td>2</td>
<td>2.0</td>
<td>4</td>
<td>added-another</td>
</tr>
<tr>
<th>2</th>
<td>3</td>
<td>2.0</td>
<td>6</td>
<td>added-another</td>
</tr>
</tbody>
</table>
</div>



.. code:: ipython3
df.loc[:, Cols.col2]
.. parsed-literal::
0 added-another
1 added-another
2 added-another
Name: col_2, dtype: object
Access Columns
--------------

while also documenting datatypes

.. code:: ipython3
from colassigner import ColAccessor
.. code:: ipython3
class Cols(ColAccessor):
x = int
y = float
.. code:: ipython3
df = pd.DataFrame({Cols.x: [1, 2, 3], Cols.y: [0.3, 0.1, 0.9]})
.. code:: ipython3
df
.. raw:: html

<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>x</th>
<th>y</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>1</td>
<td>0.3</td>
</tr>
<tr>
<th>1</th>
<td>2</td>
<td>0.1</td>
</tr>
<tr>
<th>2</th>
<td>3</td>
<td>0.9</td>
</tr>
</tbody>
</table>
</div>



.. code:: ipython3
df.loc[:, Cols.y]
.. parsed-literal::
0 0.3
1 0.1
2 0.9
Name: y, dtype: float64
Loading

0 comments on commit 1dd2fca

Please sign in to comment.