Question: insights on this: from datetime import datetime # Calculate the current year current_year = datetime.now().year # Create a new column 'Store_Tenure' representing the number of
insights on this: from datetime import datetime # Calculate the current year current_year = datetime.now().year # Create a new column 'Store_Tenure' representing the number of years a store has been established dataset['Store_Tenure'] = current_year - dataset['Store_Establishment_Year'] # Group the dataset by 'Store_Tenure' and sum the total sales for each tenure group sales_by_tenure = dataset.groupby('Store_Tenure')[target].sum().reset_index() # Plot a scatterplot showing total sales against store tenure # - Set figure size for clarity # - Use larger markers for better visibility # - Add title and axis labels # - Use tight layout to optimize spacing plt.figure(figsize=(10,6)) sns.scatterplot(data=sales_by_tenure, x='Store_Tenure', y=target, s=100) plt.title('Total Sales by Store Tenure') plt.xlabel('Store Tenure (Years)') plt.ylabel('Total Sales') plt.tight_layout() plt.show()
Total Sales le7 1.64 1.474 1.25 1.05 0.85 0.6 5 0.45 0.2 5 15 20 Total Sales by Store Tenure 25 Store Tenure (Years) 30 35Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
