Skip to content

Instantly share code, notes, and snippets.

@dharmatech
Created April 27, 2024 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dharmatech/d5b20b6efaba5e59aa835918e91335a5 to your computer and use it in GitHub Desktop.
Save dharmatech/d5b20b6efaba5e59aa835918e91335a5 to your computer and use it in GitHub Desktop.
from bokeh.plotting import figure, show
import bokeh.models
import bokeh.palettes
import bokeh.transform
import pandas as pd
import csv
df = pd.read_csv('BHCF20231231\BHCF20231231.txt', sep='^', quoting=csv.QUOTE_NONE)
df['label'] = df['RSSD9001'].astype(str) + ' ' + df['RSSD9017']
# df = pd.read_csv('BHCF20231231\BHCF20231231.txt', sep='^', quoting=csv.QUOTE_NONE, encoding='utf-8')
tmp = df[df['BHCA7204'].notnull()][['RSSD9017', 'BHCA7204', 'label']].sort_values(by='BHCA7204')
tmp = tmp.tail(50)
companies = tmp['label'].tolist()
values = tmp['BHCA7204'].tolist()
p = figure(y_range=bokeh.models.FactorRange(factors=companies), title='FR-Y-9C : BHCA7204 (Leverage)', x_axis_label='BHCA7204', y_axis_label='RSSD9017', sizing_mode='stretch_both')
p.hbar(y=companies, right=values, height=0.5)
show(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment