Skip to content
NBS Food Data 2023
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
fooddata = pd.read_csv('https://raw.githubusercontent.com/Akinnikemichael/fooddata23/main/food23.csv')
fooddata.head()
#print(fooddata)import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
# Load the data
fooddata = pd.read_csv('https://raw.githubusercontent.com/Akinnikemichael/fooddata23/main/food23.csv')
# Adjusting for seaborn scatter plot compatibility
# Seaborn expects numerical values for both axes, and "Items" seems to be categorical.
# If "YoY" is numerical and you want to plot it against "Items", consider using a categorical plot type like sns.barplot.
# Scatter plot for April 2022 Average
plt.figure(figsize=(10, 6)) # Adjusting figure size for better readability
plt.scatter(fooddata["Items"], fooddata["Average of Apr-22"])
plt.xticks(rotation=45) # Rotating x-axis labels for better readability
plt.title('Scatter Plot of Items vs. Average of Apr-22')
plt.xlabel('Items')
plt.ylabel('Average of Apr-22')
plt.show()
# Using seaborn for a categorical plot instead of regplot for "YoY" vs. "Items"
plt.figure(figsize=(10, 6))
sns.barplot(x="Items", y="YoY", data=fooddata)
plt.xticks(rotation=45)
plt.title('Bar Plot of Year-over-Year (YoY) Change by Item')
plt.xlabel('Items')
plt.ylabel('YoY')
plt.show()
# Scatter plot for March 2023 Average
plt.figure(figsize=(10, 6))
plt.scatter(fooddata["Items"], fooddata["Average of Mar-23"])
plt.xticks(rotation=45)
plt.title('Scatter Plot of Items vs. Average of Mar-23')
plt.xlabel('Items')
plt.ylabel('Average of Mar-23')
plt.show()
# Scatter plot for April 2023 Average
plt.figure(figsize=(10, 6))
plt.scatter(fooddata["Items"], fooddata["Average of Apr-23"])
plt.xticks(rotation=45)
plt.title('Scatter Plot of Items vs. Average of Apr-23')
plt.xlabel('Items')
plt.ylabel('Average of Apr-23')
plt.show()Current Type: Bar
Current X-axis: None
Current Y-axis: None
Current Color: None
Run cancelled
Run cancelled
import matplotlib.pyplot as plt
fooddata = pd.read_csv('https://raw.githubusercontent.com/Akinnikemichael/fooddata23/main/food23.csv')
foodreg = fooddata["MoM"]
foodreg1 = fooddata["Items"]
#foodreg2 = fooddata["YoY"]
plt.scatter(x=foodreg, y=foodreg1)
plt.xlabel("Month On Month")
plt.ylabel("Average of April 2023")
plt.title("NBS Selected Food 2023")
plt.show()