johnnysteeler7719 johnnysteeler7719
  • 20-11-2020
  • Computers and Technology
contestada

Write a Pandas program to import excel data (coalpublic2013.xlsx) into a dataframe and draw a bar plot where each bar will represent one of the top 10 production.

Respuesta :

IfeanyiEze8899 IfeanyiEze8899
  • 21-11-2020

Answer:

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

df = pd.read_excel('coalpublic2013.xlsx')

sorted_by_production = df.sort_values(['Production'], ascending=False).head(10)

sorted_by_production['Production'].head(10).plot(kind="bar")

plt.show()

Explanation:

The python program plot a bar chart of the top ten productions in the excel worksheet. The excel file is read in as a pandas dataframe, sorted in descending order and the first ten of the dataframe is plotted as a bar plot.

Answer Link

Otras preguntas

Fran cut her sandwich into 6 pieces. If Fran ate 1/3 of her sandwich, how many pieces did he eat?
what important polymer is located in the nucleus ?
A main function of the leaf petiole is a. to extend the leaf blade away from the stem so the blade can collect sufficient sunlight. b. to keep the leaf away from
Why did the Spanish and Portuguese launch voyages of exploration?
A student plans to conduct an experiment to determine how a change in the pH of water affects the population growth rate of algae. To ensure that her experiment
Admission to the county fair is $5. And it costs and additional $0.50 for each ride ticket. What inequality represents this problem
What is 4 1/6 minus 2 5/6
Where did Chinese civilization develop?
How to factor: n^2-5n+6
What is the symbol for aluminum thiosulfate?