Ask coding questions

← Back to all posts
whats the error
HASSANAYMAN (0)

import pandas as pd
import matplotlib.pyplot as plt
uae=pd.DateFrame = ([[1, 0], [2, 0], [3, 53], [4, 549], [5, 661], [6, 421],[7, 283], [8, 541], [9, 1100], [10, 1121], [11, 1107],[12, 1730]])
uae.columns=(["months","cases"])
print(uae)
plt.plot(uae.loc[:, "months"], uae.loc[:, "cases"])
plt.title("corona cases in the UAE")
plt.xlabel("2020y per month")
plt.ylabel("total cases")
plt.xticks([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
plt.show()

Comments
hotnewtop
Chocolate16 (36)

You should use DataFrame instead of DateFrame

Chocolate16 (36)

@HASSANAYMAN what issue are you seeing now? I ran your code and it created a plot successfully.

Chocolate16 (36)

If you see message in red so thats just warning, error if there are "tabs" @HASSANAYMAN

Chocolate16 (36)

@HASSANAYMAN, @DavidShen2 has pointed you correctly on your issue. It is redundant equal sign between DataFrame and your data in line 3.

HASSANAYMAN (0)

Thank you problem solved @Chocolate16

DavidShen2 (60)

On line 3, remove the second '=' sign.

InvisibleOne (2674)


The error is just what it says, uae does not have any attribute 'columns'