Home>
We become indebted to.
I've been learning python for about a month.
Now that I've learned the basic syntax, I'm studying how to use pandas.
Currently, as a practice of pandas, I would like to process the population transition by prefecture and finally display it as a line graph using matplotlib.
The data used is that of Table No. 3 in the link below.
Link content
Currently writing the following code
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv (r "C: \ Users \ sirar \ Desktop \ Python related \ web scraping \ lesson \ 20201110 \ c03.csv", encoding = "shift-jis")
df = df [df ["age 5 years old"] ==" total number "]
df = df.loc [:, ["Prefecture name", "AD (year)", "Population (total number)"]]
df
I was able to extract it with the extra rows and columns removed, but even if I graph it with matplotlib in this state, it does not become the expected graph.
In the end, I think that column = prefecture name and index = year (or vice versa) should be set, is that correct? What should I do to do so?
-
Answer # 1
Related articles
- python - about row extraction in pandas
- python - [question] about combining pandas data frames
- python - about pandas graphing two-row columns but i want to disable multiindex
- about the python library pandas
- python - about pandas, gspread
- about image output of python
- python - pandas attributeerror: module'pandas' has no attribute'read_tabel' error
- python - shuffle a few lines of pandas for weekdays and holidays
- python 3x - please teach about the exchange of information with qthead
- python - about x-axis adjustment in matplotlib
- eliminating pandas install and import in python pyenv export ldflags
- i have a question about basic python problems
- python - about "" "of" "" select === = "" "
- python, about the fire spread step of forest fire simulation
- python - about hamiltonian neural networks
- python - about write loop to csv
- about python argument and data definition
- python 3x - about downloading anaconda
- python - merge after pandas pivot
Related questions
- python : correctly translate the dictionary into a dataframe, where the values will be divided by keys
- python : How to set a date condition in a query with where? [duplicate]
- python : yfinance AttributeError: 'Index' object has no attribute 'tz_localize'
- python : How to add multiple columns to a multi-index DataFrame at once
- python : How to find if there is a value in a pandas.DataFrame column
- python : Moving Average of Grouped Data
- python : Error creating dataframe
- python : f -string in function
- Passing parameter list to SQL query python [duplicate]
- I can't use pandas with Python 3.8.3.
House. It is good to group by prefecture and draw for each group.