Skip to content

Instantly share code, notes, and snippets.

View hkailee's full-sized avatar
🎯
Focusing

Hong Kai LEE hkailee

🎯
Focusing
  • Singapore
View GitHub Profile
@hkailee
hkailee / adata_loading_preprocessing_CharacterizingOutperformedCompanies1MonthPostCOVID19VaccineSuccess.txt
Last active December 25, 2020 03:40
Loading adata and preprocessing for CharacterizingOutperformedCompanies1MonthPostCOVID19VaccineSuccess
# Loading pandas dataframe as anndata
adata = qp.AnnData(df_fundamental_logreturn_minmax[ls_fundamental_target])
# Saving raw data for visualization later
adata.raw = adata
# log(x+1) transformation for all data
qp.pp.log1p(adata)
# Standardization scaling per feature
import plotly.express as px
# grouping statistics
ds = df_all.groupby(['leiden', 'GICS Sector', 'GICS Sub-Industry'])['log_return_1mth'].count().reset_index()
ds.columns = ['leiden', 'GICS Sector', 'GICS Sub-Industry', 'count']
# plotting sunburst
fig = px.sunburst(
ds,
path=[