Skip to content

Commit bbe1866

Browse files
authored
Merge pull request #191 from lincc-frameworks/revised_intro
overhaul intro example
2 parents 7a0c3bd + 916dcd8 commit bbe1866

File tree

7 files changed

+71
-4
lines changed

7 files changed

+71
-4
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,40 @@ tooling and support for nested dataframes packed into values of top-level
1818
dataframe columns. [Pyarrow](https://arrow.apache.org/docs/python/index.html)
1919
is used internally to aid in scalability and performance.
2020

21-
![image](./nestedframe.png)
21+
Nested-Pandas allows data like this:
22+
23+
<p align="center">
24+
<img src="./docs/intro_images/pandas_dfs.png" alt="pandas dataframes" width="400"/>
25+
</p>
26+
27+
To instead be represented like this:
28+
29+
<p align="center">
30+
<img src="./docs/intro_images/nestedframe.png" alt="nestedframe" width="400"/>
31+
</p>
32+
33+
Where the nested data is represented as nested dataframes:
34+
35+
```python
36+
# Each row of "object_nf" now has it's own sub-dataframe of matched rows from "source_df"
37+
object_nf.loc[0]["nested_sources"]
38+
```
39+
40+
<p align="center">
41+
<img src="./docs/intro_images/loc_into_nested.png" alt="sub-dataframe" width="225"/>
42+
</p>
43+
44+
Allowing powerful and straightforward operations, like:
45+
46+
```python
47+
# Compute the mean flux for each row of "object_nf"
48+
import numpy as np
49+
object_nf.reduce(np.mean, "nested_sources.flux")
50+
```
51+
52+
<p align="center">
53+
<img src="./docs/intro_images/reduce.png" alt="using reduce" width="150"/>
54+
</p>
2255

2356
Nested-Pandas is motivated by time-domain astronomy use cases, where we see
2457
typically two levels of information, information about astronomical objects and

docs/index.rst

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,44 @@ tooling and support for nested dataframes packed into values of top-level
1414
dataframe columns. `Pyarrow <https://arrow.apache.org/docs/python/index.html>`_
1515
is used internally to aid in scalability and performance.
1616

17-
.. image:: ../nestedframe.png
18-
:width: 600
17+
Nested-Pandas allows data like this:
18+
19+
.. image:: ./intro_images/pandas_dfs.png
20+
:width: 400
21+
:align: center
22+
:alt: pandas dataframes
23+
24+
To instead be represented like this:
25+
26+
.. image:: ./intro_images/nestedframe.png
27+
:width: 400
28+
:align: center
29+
:alt: pandas dataframes
30+
31+
Where the nested data is represented as nested dataframes:
32+
33+
.. code-block:: python
34+
35+
# Each row of "object_nf" now has it's own sub-dataframe of matched rows from "source_df"
36+
object_nf.loc[0]["nested_sources"]
37+
38+
.. image:: ./intro_images/loc_into_nested.png
39+
:width: 225
40+
:align: center
41+
:alt: pandas dataframes
42+
43+
Allowing powerful and straightforward operations, like:
44+
45+
.. code-block:: python
46+
47+
# Compute the mean flux for each row of "object_nf"
48+
import numpy as np
49+
object_nf.reduce(np.mean, "nested_sources.flux")
50+
51+
.. image:: ./intro_images/reduce.png
52+
:width: 150
1953
:align: center
20-
:alt: Example NestedFrame
54+
:alt: pandas dataframes
2155

2256
Nested-Pandas is motivated by time-domain astronomy use cases, where we see
2357
typically two levels of information, information about astronomical objects and

docs/intro_images/loc_into_nested.png

75.1 KB
Loading

docs/intro_images/nestedframe.png

109 KB
Loading

docs/intro_images/pandas_dfs.png

126 KB
Loading

docs/intro_images/reduce.png

50.2 KB
Loading

nestedframe.png

-78.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)