I tried to filter some datas from a csv file. It worked fine. Now i wanted to do some graphs with altair. I imported it already.
Forest=pd.read_csv("AnnualChangeForest.csv", sep=',')
Forest
print(Forest.loc[[46, 47, 48, 49, 81, 82, 83, 84, 444, 445, 446 ]])
Entity Code Year Annual net change in forest area
46 Brazil BRA 1990 -3780940.0
47 Brazil BRA 2000 -3950790.0
48 Brazil BRA 2010 -1539180.0
49 Brazil BRA 2015 -1453040.0
81 China CHN 1990 1986000.0
82 China CHN 2000 2360980.0
83 China CHN 2010 1936770.0
84 China CHN 2015 1936790.0
444 United States USA 1990 108600.0
445 United States USA 2000 518400.0
446 United States USA 2010 275000.0
Forest2=print(Forest.loc[[46, 47, 48, 49, 81, 82, 83, 84, 444, 445, 446 ]])
alt.Chart(Forest2).mark_bar().encode(
x="Year",
y="Annual net change in forest area",
)
Year encoding field is specified without a type; the type cannot be automatically inferred because the data is not specified as a pandas.DataFrame.
I wanted to do some Charts. In the result i got an error message. I think it is because "Forest2" wasnt read with the "reading csv" command.
What do i have to know to get the chart working with "Forest2"
Thank you. If i have made any mistakes in this forum according to the rules, i apologize. Its my first post here.
I think the following line is the issue.
Forest2=print(Forest.loc[[46, 47, 48, 49, 81, 82, 83, 84, 444, 445, 446 ]])
print
function doesn't return anything, so None
is getting assigned to the Forest2
variable.
It should be
Forest2= Forest.loc[[46, 47, 48, 49, 81, 82, 83, 84, 444, 445, 446 ]]