21 lines
712 B
Python
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)
|