Closed Jacklau9515 closed 4 years ago
figured it out, thx
Hi @Jacklau9515. Thank you for your issues. Would you mind sharing how you solved it?
Maybe other developers will need this information too.
Regards
Hi @Jacklau9515. Thank you for your issues. Would you mind sharing how you solved it?
Maybe other developers will need this information too.
Regards
Hi @jbesomi. No worries, and I will share my code below:
import texthero as hero
import pandas as pd
import chart_studio
import chart_studio.plotly as py
chart_studio.tools.set_credentials_file(username='your_username', api_key='your_apikey')
chart_studio.tools.set_config_file(world_readable=True, sharing='public')
df = pd.read_csv(
"https://github.com/jbesomi/texthero/raw/master/dataset/bbcsport.csv"
)
df['pca'] = (
df['text']
.pipe(hero.clean)
.pipe(hero.tfidf)
.pipe(hero.pca)
)
fig = hero.scatterplot(df, col='pca', color='topic', title="PCA BBC Sport news", return_figure=True)
py.plot(fig, filename='bbc-test', auto_open=True)
Please feel free put it into your document if you wish :)
Thank you @Jacklau9515. Great! If you have any other feedback and/or advice, please let us know. Regards
Hi,
I am just curious about if it is doable I can directly upload the plot to my plotly dashboard once called hero.scatterplot()?
chart_studio.tools.set_credentials_file(username='username', api_key='token') chart_studio.tools.set_config_file(world_readable=True, sharing='public')
Regards, Jack