Spaces:
Runtime error
Runtime error
import streamlit as st | |
import pandas as pd | |
from modules.data_preparation import prepare_df, plot_3dgraph | |
import numpy as np | |
import datetime | |
st.title('Sentiment Analysis for Price Trend Prediction') | |
st.header(f'Data based on Platts News and Insights Data') | |
st.subheader(f'{datetime.datetime.now()}') | |
news_category = st.selectbox("Select Market Movers Category", ("Crude Oil", "Light Ends", "Middle Distillates", "Heavy Distillates")) | |
latest_news = prepare_df(pd.read_csv('data/results_platts_09082024_clean.csv'), news_category) | |
top_news = prepare_df(pd.read_csv('data/topresults_platts_09082024_clean.csv'), news_category) | |
df_news = pd.concat([latest_news, top_news], ignore_index=True).drop_duplicates(['headline']) | |
df_mean = pd.DataFrame({ | |
'headline' : ['MEAN OF ALL NEWS'], | |
'negative_score' : [df_news['negative_score'].mean()], | |
'neutral_score' : [df_news['neutral_score'].mean()], | |
'positive_score' : [df_news['positive_score'].mean()], | |
'topic_verification' : [''] | |
}) | |
df_news_final = pd.concat([df_news, df_mean]).drop(columns=['body']) | |
df_news_final.index = np.arange(1, len(df_news_final) + 1) | |
df_news_final | |
st.plotly_chart(plot_3dgraph(df_news_final), use_container_width=True) |