Skip to content

Commit 7fef018

Browse files
committed
wip
1 parent dec9ac4 commit 7fef018

File tree

2 files changed

+19
-45
lines changed

2 files changed

+19
-45
lines changed

README.md

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pyjviz
22

3-
`pyjviz` is Python package to visual support of programmers and data engeneers efforts using `pyjanitor` package.
3+
`pyjviz` is Python package to deliver some level of visual support to help programmers and data engeneers to use `pyjanitor` package.
44
`pyjviz` provides simple way to see method call chains flow and intermidiate results.
55

66
## Quick start
@@ -22,6 +22,8 @@ Resulting logs are in ~/.pyjviz/rdflog - visualized output stored in .svg files.
2222
Consider pyjanitor example why-janitor.py. Modified version is given below (also avaliable here):
2323

2424
```python
25+
# using example from https://pyjanitor-devs.github.io/pyjanitor/#why-janitor as base
26+
2527
import numpy as np
2628
import pandas as pd
2729
import janitor
@@ -30,39 +32,25 @@ import pyjviz
3032
# Sample Data curated for this example
3133
company_sales = {
3234
'SalesMonth': ['Jan', 'Feb', 'Mar', 'April'],
33-
'Company1': [150.0, 200.0, 300.0, 400.0],
34-
'Company2': [180.0, 250.0, np.nan, 500.0],
35-
'Company3': [400.0, 500.0, 600.0, 675.0]
36-
}
35+
'Company1': [150.0, 200.0, 300.0, 400.0],
36+
'Company2': [180.0, 250.0, np.nan, 500.0],
37+
'Company3': [400.0, 500.0, 600.0, 675.0]
38+
}
3739

3840
print(pd.DataFrame.from_dict(company_sales))
39-
# SalesMonth Company1 Company2 Company3
40-
# 0 Jan 150.0 180.0 400.0
41-
# 1 Feb 200.0 250.0 500.0
42-
# 2 Mar 300.0 NaN 600.0
43-
# 3 April 400.0 500.0 675.0
4441

45-
with pyjviz.CB() as sg:
42+
with pyjviz.CB("WHY JANITOR?") as sg:
4643
df = (
47-
pd.DataFrame.from_dict(company_sales)
48-
.remove_columns(["Company1"])
49-
.dropna(subset=["Company2", "Company3"])
50-
.rename_column("Company2", "Amazon")
51-
.rename_column("Company3", "Facebook")
52-
.add_column("Google", [450.0, 550.0, 800.0])
53-
)
54-
55-
# Output looks like this:
56-
# Out[15]:
57-
# SalesMonth Amazon Facebook Google
58-
# 0 Jan 180.0 400.0 450.0
59-
# 1 Feb 250.0 500.0 550.0
60-
# 3 April 500.0 675.0 800.0
61-
62-
# comment line below to fix spurious apply calls caused by pandas printing implementation
63-
print(df)
64-
65-
pyjviz.save_dot(vertical = True)
44+
pd.DataFrame.from_dict(company_sales)
45+
.remove_columns(["Company1"])
46+
.dropna(subset=["Company2", "Company3"])
47+
.rename_column("Company2", "Amazon")
48+
.rename_column("Company3", "Facebook")
49+
.add_column("Google", [450.0, 550.0, 800.0])
50+
)
51+
print(df)
52+
53+
pyjviz.save_dot(vertical = True, popup_output = True)
6654
```
6755

6856
The [`result`][res] of run is SVG file with clickable nodes to provide the way to see some details of program behaviour and generated data objects.

examples/scripts/why-janitor.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@
1414
}
1515

1616
print(pd.DataFrame.from_dict(company_sales))
17-
# SalesMonth Company1 Company2 Company3
18-
# 0 Jan 150.0 180.0 400.0
19-
# 1 Feb 200.0 250.0 500.0
20-
# 2 Mar 300.0 NaN 600.0
21-
# 3 April 400.0 500.0 675.0
2217

23-
with pyjviz.CB() as sg:
18+
with pyjviz.CB("WHY JANITOR?") as sg:
2419
df = (
2520
pd.DataFrame.from_dict(company_sales)
2621
.remove_columns(["Company1"])
@@ -29,15 +24,6 @@
2924
.rename_column("Company3", "Facebook")
3025
.add_column("Google", [450.0, 550.0, 800.0])
3126
)
32-
33-
# Output looks like this:
34-
# Out[15]:
35-
# SalesMonth Amazon Facebook Google
36-
# 0 Jan 180.0 400.0 450.0
37-
# 1 Feb 250.0 500.0 550.0
38-
# 3 April 500.0 675.0 800.0
39-
40-
# comment line below to fix spurious apply calls caused by pandas printing implementation
4127
print(df)
4228

4329
pyjviz.save_dot(vertical = True, popup_output = True)

0 commit comments

Comments
 (0)