1
1
# pyjviz
2
2
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.
4
4
` pyjviz ` provides simple way to see method call chains flow and intermidiate results.
5
5
6
6
## Quick start
@@ -22,6 +22,8 @@ Resulting logs are in ~/.pyjviz/rdflog - visualized output stored in .svg files.
22
22
Consider pyjanitor example why-janitor.py. Modified version is given below (also avaliable here):
23
23
24
24
``` python
25
+ # using example from https://pyjanitor-devs.github.io/pyjanitor/#why-janitor as base
26
+
25
27
import numpy as np
26
28
import pandas as pd
27
29
import janitor
@@ -30,39 +32,25 @@ import pyjviz
30
32
# Sample Data curated for this example
31
33
company_sales = {
32
34
' 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
+ }
37
39
38
40
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
44
41
45
- with pyjviz.CB() as sg:
42
+ with pyjviz.CB(" WHY JANITOR? " ) as sg:
46
43
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 )
66
54
```
67
55
68
56
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.
0 commit comments