Jovian
⭐️
Sign In
In [ ]:
import jovian

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

sns.set(style="darkgrid")

df = pd.read_csv('fortune500.csv')

df.columns = ['year', 'rank', 'company', 'revenue', 'profit']
non_numeric_profits = df.profit.str.contains('[^0-9.-]')

# Removing the non numeric values from our dataset.
df = df.loc[~non_numeric_profits]
df.profit = df.profit.apply(pd.to_numeric)
df.head()
df.tail()

profit_grouped_by_year = df.loc[:, ['year', 'revenue', 'profit']].groupby('year')

avgs = profit_grouped_by_year.mean()
x = avgs.index
y = avgs.profit

def plot(x, y, ax, title, y_label):
    ax.set_title(title)
    ax.set_ylabel(y_label)
    ax.plot(x, y)
    ax.margins(x=0, y=0)
    
fig, ax = plt.subplots()
plot(x, y, ax, 'Increase in mean Fortune 500 company profits from 1955 to 2005', 'Profit (millions)')

jovian.commit()
jovian.commit(artifacts='fortune500.csv')
[jovian] Saving notebook..
[jovian] Updating notebook "90b663051dc84e8982d472742a0d36d0" on https://jvn.io [jovian] Uploading notebook.. [jovian] Capturing environment.. [jovian] Committed successfully! https://jvn.io/manjotpahwa/90b663051dc84e8982d472742a0d36d0 [jovian] Saving notebook..
[jovian] Error: Failed to read Anaconda environment using command: "conda env export -n base --no-builds"
In [ ]:
 
In [ ]: