df.plot.line() 是 matplotlib 还是 seaborn? (蟒蛇 3)

时间:2021-03-09 02:51:16

标签: python matplotlib seaborn

我有这些变量可以找到 5 个列的 5 个总和,如下所示:

TotalUnitsSold = mmSalesDF['Units Sold'].sum()
TotalUnitsCost = mmSalesDF['Unit Cost'].sum()
TotalRevenue = mmSalesDF['Total Revenue'].sum()
TotalCost = mmSalesDF['Total Cost'].sum()
TotalProfit = mmSalesDF['Total Profit'].sum()

我需要使用 matplotlib 或 seaborn 创建一个线图,所以我的代码如下:

# Create a pandas dataframe with variables above, index is the column names
df = pd.DataFrame({
   'Total': [TotalUnitsSold, TotalUnitsCost, TotalRevenue, TotalCost, TotalProfit],
   }, index=['Unit Sold', 'Unit Cost', 'Revenue', 'Cost', 'Profit'])

# Create the line plot 
lines = df.plot.line()
plt.yscale('log')

不知代码行

lines = df.plot.line()

是matplotlib吗?如果不是,我如何修复它以满足要求?

0 个答案:

没有答案