Create scatter plot with pandas columns
Let's visualize some data from the companies dataset. Compare the companies' expenses and revenue using a scatter plot. Create a plot that matches the one in the image. Hint: First, extract the correct columns from the DataFrame. Use the
DataFrame.columns
attribute to find the correct column names. You need to divide the column values by 1000 for the plot.Expected:
Output:
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('/data/companies.csv')
# add your code here
plt.xlabel('Expenses (in 1000s)')
plt.ylabel('Revenue (in 1000s)')
plt.show()
Python
Setting up Python environment...
Output