GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Sample_datapane_script/script.py at master · khuyentran1401/Sample_datapane_script

Expand file tree

/

script.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
37 lines (28 loc) · 1.47 KB
/

script.py

Copy path

File metadata and controls

37 lines (28 loc) · 1.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import pandas as pd
import altair as alt
import datapane as dp
import pickle
# load objects and plots
author_rank = dp.Blob.get('author_rank', owner='khuyentran1401').download_obj()
author_count = pickle.load(open('./author_count', 'rb'))
publication_count = pickle.load(open('./publication_count', 'rb'))
publication_rank = pickle.load(open('./publication_rank', 'rb'))
# size of the data
data_size = len(author_rank)
# load parameters from input
dp.Params.load_defaults('datapane.yaml')
author = dp.Params.get('author_name', 'Khuyen Tran')
publication = dp.Params.get('publication_name')
percentile_author = 100-(list(author_rank).index(author)+1)/len(author_rank) * 100
percentile_publications = 100 - (list(publication_rank).index(publication)+1)/len(publication_rank) * 100
dp.Report(
dp.Markdown("# Medium Visualization"),
dp.Plot(author_count),
dp.Markdown(f'''
Author {author} ranks {list(author_rank).index(author)+1} out of {data_size} authors who publish most frequently on topics related to data science last year, which is
in the {str(round(percentile_author,2))}% percentile
'''),
dp.Plot(publication_count),
dp.Markdown(f'''Publication {publication} ranks {list(publication_rank).index(publication)+1} out of {data_size} publications which publish most frequently on topics related to data science last year, which is
in the {str(round(percentile_publications,2))}% percentile'''),
).publish(headline='Medium Visualization', name='medium_report')
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.