I have studied, Python, Kivy, Postgres, Peewee, Django, Pandas and now Dash.
I only started this way because in Telegram and Whatsapp groups I have been asked a lot of questions about my knowledge that are running things over.
But you are right, I usually do that, however, I think that my doubt could be answered without enigmas, without hurt anyone but I want to say that I am not a professional programmer, I don't have a paid activity, everything is fun.
Let's get to what really matters:
I can't plot a line graph as I have been told that I am indexing the data, I don't know where I am doing this.
Can someone help me plot this chart without errors?
For creating a graph, it is usually used with matplotlib. I looked at your code and successfully run it, but I do not think this is something that you like to do, so I plot your data by using matplotlib.
MesAno has type string, so let's convert to something comparable.
from datetime import datetime
datetime.strptime(str(movimento_por_mes_vendedores['MesAno'].iloc[1]), '%Y-%m')
movimento_por_mes_vendedores['MesAno'] = movimento_por_mes_vendedores['MesAno'].fillna(0) #NANを0置換
for i in range(0, movimento_por_mes_vendedores.shape[0]):
movimento_por_mes_vendedores['MesAno'].iloc[i] = datetime.strptime(str(movimento_por_mes_vendedores['MesAno'].iloc[i]), '%Y-%m')
And store those data in list
postDatedList = []
for i in range(0, movimento_por_mes_vendedores.shape[0]):
postDatedList.append(datetime(
movimento_por_mes_vendedores['MesAno'].iloc[i].year,
movimento_por_mes_vendedores['MesAno'].iloc[i].month,
movimento_por_mes_vendedores['MesAno'].iloc[i].day
))
debitAmountList = []
for i in range(0, movimento_por_mes_vendedores.shape[0]):
debitAmountList.append(movimento_por_mes_vendedores['qtitem'].iloc[i])
print("post shape: " + str(len(debitAmountList)))
Then you can compare those two with matplotlib
x = postDatedList
y = debitAmountList
fig = plt.figure(figsize=(30,10), dpi=100, facecolor='white')
ax = fig.add_subplot(111)
ax.bar(x, y, width=20, align="center")
ax.xaxis_date()
plt.title('Financial Graph')
plt.xlabel("Date")
plt.ylabel("Amount")
plt.grid(True)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.