导入数据
import pandas as pd
import numpy as np
topic = pd.read_csv('https://cocl.us/datascience_survey_data',index_col=0)
topic
计算对整体的比例
共有2233人参加了调研
#Sort the dataframe in descending order of Very interested. 降序排列
topic.sort_values(['Very interested'],ascending=False,inplace=True)
#Convert the numbers into percentages of the total number of respondents.. Round percentages to 2 decimal places. 计算百分比,保留两位小数
topicp= (100*topic/2233).round(2)
topicp
柱状图
fig = plt.figure