I am trying to visualize the following data frame [df_event] that stores events from Hokkaido to Okinawa (about 1800) with Matplotlib.
I tried to graph and compare the TOP10 of the event area and the TOP10 cost, but I can't write well. .
I will ask you questions in order.
The questions are in bold, so please read through the professors.
|Event name||Prefecture name||Prefectural No.||Cost (10,000 yen)||Event area (ha)||Date|
|OO Birthday Festival||Osaka Prefecture||26||227||33700||1895|
# Extract TOP10 of event area df_event_area_sort = df_event ['Event area (ha)']. sort_values (ascending = False) df_event_area_sort_10 = df_event_area_sort [: 10] print (df_event_area_sort_10)
When the above code is entered, the following output results.
Is it possible to link the output result row number to any column name (event name)?
591 210000 1323 137800 494 120800 1325 116500 601 108 150 1068 102000 596 98000 1322 95400 1808 77300 595 73000
If i type the following code based on the output result above, the following line graph will be displayed.
How can I make this line chart stretch horizontally?
(I think you can fix it by changing the line number to the event name)
Thanks for your help.
Answer # 1
dd = df_event.sort_values (['Event area (ha)'], ascending = False) [: 10] dd.set_index ('event name') ['event surface area (ha)']. plot (kind = 'barh')
Answer # 2
A method of making a line graph anyway.
plt.plot (df_gesui_area_sort_10.values) plt.show ()
How to create a line graph with a name.
df_gesui_area_sort_10 = df_gesui_area_sort_10.set_index ('event_name') plt.plot (df_gesui_area_sort_10) plt.show ()
- i want to output as a new file using csv in python
- i don't understand the exercises using python trigonometric functions
- python - i want to separate by a specific word using the split function
- python - image recognition using cnn keras multiple inputs
- python - matplotlib i want to draw a horizontal line
- python - i want to design a cnn with 2 inputs and 1 output with keras
- about batch change of file name using python
- [python] graphviz output format error
- python 3x - i want to get the nth array with an argument using python3 argparse
- python 3x - how to rename a folder created using jupyternotebook
- python: of the results obtained by the for statement, i want to make an empty array like  into [''']
- python - [pytorch] i want to get the output of the middle layer of a complicated model
- python - about x-axis adjustment in matplotlib
- python 3x - processing to jump to the link destination using chrome driver in python
- python - error in image binarization using cv2adaptivethreshold function
- extract from python dat data and output to csv
- python 3x - the output result of the numerical value obtained by web scraping becomes 0
- about image output of python
- i want to adjust the execution result using the while statement in python as expected
- python - i want to put the image file path in a variable and open it using that variable
- python : Find the number of weeks in the quarter and month
- python : How to create other columns with binary signs by value from the speaker?
- python : How to make a normal output?
- python : Using Apply in Pandas
- python : NUMPY Installation Error
- python : Calculate the number of values in the Dataprama column
- python : Why is if inside the function not working correctly?
- python : VWAP calculation, ends with RAM, the code is performed too long
- python : How to rescue from the site specific data?
- Python -How to create a 2D array of DataFrame?