Use the code template below
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
<imports>
# solution plan
# i. ..
def plot(data: pd.DataFrame):
# ii. convert Retail_Price and Dealer_Cost to log scale
data['Retail_Price_log'] = data['Retail_Price'].apply(lambda x: np.log(x))
data['Dealer_Cost_log'] = data['Dealer_Cost'].apply(lambda x: np.log(x))
# iii. plot the distribution of Retail_Price and Dealer_Cost
plt.figure(figsize=(10, 6))
sns.histplot(data=data, x='Retail_Price_log', color='red', alpha=0.5, label='Retail_Price')
sns.histplot(data=data, x='Dealer_Cost_log', color='blue', alpha=0.5, label='Dealer_Cost')
plt.xlabel('Log Scale')
plt.ylabel('Frequency')
plt.legend()
plt.title('What is the distribution of Retail_Price and Dealer_Cost?', wrap=True)
return plt;
chart = plot(data) # data already contains the data to be plotted. Always include this line. No additional code beyond this line.. DO NOT modify the rest of the code template.
****
name 'np' is not defined
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/tmp/ipykernel_1490/2717688829.py in <module>
4 charts = lida.visualize(summary=summary, goal=goals[i], textgen_config=textgen_config, library=library)
5 # plot raster image of chart
----> 6 plot_raster(charts[0].raster)
IndexError: list index out of range
I want to learn how to use lida, so I ran the tutorial jupyter notebook, when I ran the command
I got the below issue: