• <tfoot id='iaqUR'></tfoot>
    <i id='iaqUR'><tr id='iaqUR'><dt id='iaqUR'><q id='iaqUR'><span id='iaqUR'><b id='iaqUR'><form id='iaqUR'><ins id='iaqUR'></ins><ul id='iaqUR'></ul><sub id='iaqUR'></sub></form><legend id='iaqUR'></legend><bdo id='iaqUR'><pre id='iaqUR'><center id='iaqUR'></center></pre></bdo></b><th id='iaqUR'></th></span></q></dt></tr></i><div id='iaqUR'><tfoot id='iaqUR'></tfoot><dl id='iaqUR'><fieldset id='iaqUR'></fieldset></dl></div>
  • <small id='iaqUR'></small><noframes id='iaqUR'>

      <bdo id='iaqUR'></bdo><ul id='iaqUR'></ul>

    <legend id='iaqUR'><style id='iaqUR'><dir id='iaqUR'><q id='iaqUR'></q></dir></style></legend>

        在 pandas 折线图中绘制多列

        Plotting multiple columns in a pandas line graph(在 pandas 折线图中绘制多列)
        <tfoot id='HD6q7'></tfoot>

        <legend id='HD6q7'><style id='HD6q7'><dir id='HD6q7'><q id='HD6q7'></q></dir></style></legend>

          <bdo id='HD6q7'></bdo><ul id='HD6q7'></ul>
          • <i id='HD6q7'><tr id='HD6q7'><dt id='HD6q7'><q id='HD6q7'><span id='HD6q7'><b id='HD6q7'><form id='HD6q7'><ins id='HD6q7'></ins><ul id='HD6q7'></ul><sub id='HD6q7'></sub></form><legend id='HD6q7'></legend><bdo id='HD6q7'><pre id='HD6q7'><center id='HD6q7'></center></pre></bdo></b><th id='HD6q7'></th></span></q></dt></tr></i><div id='HD6q7'><tfoot id='HD6q7'></tfoot><dl id='HD6q7'><fieldset id='HD6q7'></fieldset></dl></div>
              <tbody id='HD6q7'></tbody>

              <small id='HD6q7'></small><noframes id='HD6q7'>

                1. 本文介绍了在 pandas 折线图中绘制多列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在折线图中绘制多个列,其中月"作为 X 轴,每个计数"作为新行.我希望它有 5 行,'Count-18..Count-14'.我尝试绘制 1 行作为测试,但是当我运行以下代码时,我得到以下输出但没有图表.有什么想法吗?

                  I am trying to plot a multiple columns in a line graph with 'Month' as the X axis and each 'Count' as a new line. I want it to have 5 lines, 'Count-18..Count-14'. I tried plotting 1 line as a test but when I run the following code I get the following output with no graph. Any ideas?

                  ax = plt.gca()
                  
                  DomReg1418.plot(kind='line',x='Month',y='Count-18',ax=ax)
                  

                  推荐答案

                  当你有一个 DataFrame 有一列用作 X 轴和其他作为绘制线条的来源,您应该:

                  When you have a DataFrame with one column to be used as X axis and other as a source of lines to draw, you should:

                  • 将索引设置为X"列(在您的情况下为 Month),
                  • 运行绘图
                  • 用分号结束命令,以阻止文本消息关于图片对象.

                  代码如下:

                  DomReg1418.set_index('Month').plot();
                  

                  对于测试,我在前 6 个月输入了 X 和 3 个 Count 列并执行上述命令,得到如下结果:

                  For the test, I entered X and 3 Count columns, for first 6 months and executed the above command, getting the following result:

                  这篇关于在 pandas 折线图中绘制多列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                  Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                  python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                  Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                  How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                  Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)
                  • <legend id='SCXgd'><style id='SCXgd'><dir id='SCXgd'><q id='SCXgd'></q></dir></style></legend>
                  • <tfoot id='SCXgd'></tfoot>
                      <tbody id='SCXgd'></tbody>
                        <bdo id='SCXgd'></bdo><ul id='SCXgd'></ul>
                        1. <small id='SCXgd'></small><noframes id='SCXgd'>

                          <i id='SCXgd'><tr id='SCXgd'><dt id='SCXgd'><q id='SCXgd'><span id='SCXgd'><b id='SCXgd'><form id='SCXgd'><ins id='SCXgd'></ins><ul id='SCXgd'></ul><sub id='SCXgd'></sub></form><legend id='SCXgd'></legend><bdo id='SCXgd'><pre id='SCXgd'><center id='SCXgd'></center></pre></bdo></b><th id='SCXgd'></th></span></q></dt></tr></i><div id='SCXgd'><tfoot id='SCXgd'></tfoot><dl id='SCXgd'><fieldset id='SCXgd'></fieldset></dl></div>