This repository has been archived on 2023-06-18. You can view files and clone it, but cannot push or open issues or pull requests.
va-project/indexer/EPS.py
2023-05-24 10:02:09 +02:00

21 lines
712 B
Python

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def compare_tickers(tickers: list):
combined_df = pd.DataFrame()
for ticker in tickers:
filepath = f'Companies_Data/{ticker}_Data/{ticker}earnings.csv'
eps_quarterly = pd.read_csv(filepath)
ticker_df = eps_quarterly.loc[eps_quarterly['symbol'] == ticker]
ticker_df['ticker'] = ticker
combined_df = combined_df._append(ticker_df)
sns.catplot(data=combined_df, x='quarter', y='epsActual', hue='ticker', kind='bar', aspect=2)
plt.xticks(rotation=30)
plt.title('Earnings per Share (EPS)')
plt.show()
tickers_list = ['INTC', 'AAPL', 'GOOGL']
compare_tickers(tickers_list)