Please I need help I want to plot a graph using
pandas.dataframe.plot(kind='scatter' , x=x , y=y )
for a dictionary type {‘2022-01-30’: 50, ‘2022-01-31’: 152, ‘2022-02-01’: 41 }
Please how can I use dictionary since i need a title
It is giving me the error x is not defined
x is the key and
y is the value
but on the graph x should be ‘Date’ and y should be ‘Quantity’
>Solution :
You have to create a DataFrame first:
import pandas as pd
import matplotlib.pyplot as plt
data = {'2022-01-30': 50, '2022-01-31': 152, '2022-02-01': 41}
df = pd.Series(data, name='y').rename_axis('x').reset_index()
df.plot(kind='scatter', x='x', y='y')
plt.show()
