plot data on graph using python [duplicate]












-5















This question is an exact duplicate of:




  • draw data in graph using random forest python [on hold]

    1 answer




how to plot this panda data set and show the destination id is x axis and prices is y axis on graph using python



destinationId = [2,5,4,4,5,7,8,7]
prices = [755, 800, 500, 400, 152, 444, 784, 954, 120]

df = pd.DataFrame([carriersID, destinationId, montheName, prices]).T
df.columns = ['carriersID', 'destinationId', 'departureDate', 'prices']
print(df)


+---+-------------+---------------+---------------+--------+
| | carriersID | destinationId | departureDate | prices |
+---+-------------+---------------+---------------+--------+
| 0 | 1.0 | 2.0 | 1.0 | 755.0 |
| 1 | 2.0 | 5.0 | 2.0 | 800.0 |
| 2 | 3.0 | 4.0 | 3.0 | 500.0 |
| 3 | 5.0 | 4.0 | 4.0 | 400.0 |
| 4 | 6.0 | 5.0 | 5.0 | 152.0 |
| 5 | 7.0 | 7.0 | 7.0 | 444.0 |
| 6 | 8.0 | 8.0 | 8.0 | 784.0 |
| 7 | 9.0 | 7.0 | NaN | 954.0 |
| 8 | NaN | NaN | NaN | 120.0 |
+---+-------------+---------------+---------------+--------+









share|improve this question















marked as duplicate by desertnaut, jpp pandas
Users with the  pandas badge can single-handedly close pandas questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 27 '18 at 15:25


This question was marked as an exact duplicate of an existing question.




















    -5















    This question is an exact duplicate of:




    • draw data in graph using random forest python [on hold]

      1 answer




    how to plot this panda data set and show the destination id is x axis and prices is y axis on graph using python



    destinationId = [2,5,4,4,5,7,8,7]
    prices = [755, 800, 500, 400, 152, 444, 784, 954, 120]

    df = pd.DataFrame([carriersID, destinationId, montheName, prices]).T
    df.columns = ['carriersID', 'destinationId', 'departureDate', 'prices']
    print(df)


    +---+-------------+---------------+---------------+--------+
    | | carriersID | destinationId | departureDate | prices |
    +---+-------------+---------------+---------------+--------+
    | 0 | 1.0 | 2.0 | 1.0 | 755.0 |
    | 1 | 2.0 | 5.0 | 2.0 | 800.0 |
    | 2 | 3.0 | 4.0 | 3.0 | 500.0 |
    | 3 | 5.0 | 4.0 | 4.0 | 400.0 |
    | 4 | 6.0 | 5.0 | 5.0 | 152.0 |
    | 5 | 7.0 | 7.0 | 7.0 | 444.0 |
    | 6 | 8.0 | 8.0 | 8.0 | 784.0 |
    | 7 | 9.0 | 7.0 | NaN | 954.0 |
    | 8 | NaN | NaN | NaN | 120.0 |
    +---+-------------+---------------+---------------+--------+









    share|improve this question















    marked as duplicate by desertnaut, jpp pandas
    Users with the  pandas badge can single-handedly close pandas questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Dec 27 '18 at 15:25


    This question was marked as an exact duplicate of an existing question.


















      -5












      -5








      -5








      This question is an exact duplicate of:




      • draw data in graph using random forest python [on hold]

        1 answer




      how to plot this panda data set and show the destination id is x axis and prices is y axis on graph using python



      destinationId = [2,5,4,4,5,7,8,7]
      prices = [755, 800, 500, 400, 152, 444, 784, 954, 120]

      df = pd.DataFrame([carriersID, destinationId, montheName, prices]).T
      df.columns = ['carriersID', 'destinationId', 'departureDate', 'prices']
      print(df)


      +---+-------------+---------------+---------------+--------+
      | | carriersID | destinationId | departureDate | prices |
      +---+-------------+---------------+---------------+--------+
      | 0 | 1.0 | 2.0 | 1.0 | 755.0 |
      | 1 | 2.0 | 5.0 | 2.0 | 800.0 |
      | 2 | 3.0 | 4.0 | 3.0 | 500.0 |
      | 3 | 5.0 | 4.0 | 4.0 | 400.0 |
      | 4 | 6.0 | 5.0 | 5.0 | 152.0 |
      | 5 | 7.0 | 7.0 | 7.0 | 444.0 |
      | 6 | 8.0 | 8.0 | 8.0 | 784.0 |
      | 7 | 9.0 | 7.0 | NaN | 954.0 |
      | 8 | NaN | NaN | NaN | 120.0 |
      +---+-------------+---------------+---------------+--------+









      share|improve this question
















      This question is an exact duplicate of:




      • draw data in graph using random forest python [on hold]

        1 answer




      how to plot this panda data set and show the destination id is x axis and prices is y axis on graph using python



      destinationId = [2,5,4,4,5,7,8,7]
      prices = [755, 800, 500, 400, 152, 444, 784, 954, 120]

      df = pd.DataFrame([carriersID, destinationId, montheName, prices]).T
      df.columns = ['carriersID', 'destinationId', 'departureDate', 'prices']
      print(df)


      +---+-------------+---------------+---------------+--------+
      | | carriersID | destinationId | departureDate | prices |
      +---+-------------+---------------+---------------+--------+
      | 0 | 1.0 | 2.0 | 1.0 | 755.0 |
      | 1 | 2.0 | 5.0 | 2.0 | 800.0 |
      | 2 | 3.0 | 4.0 | 3.0 | 500.0 |
      | 3 | 5.0 | 4.0 | 4.0 | 400.0 |
      | 4 | 6.0 | 5.0 | 5.0 | 152.0 |
      | 5 | 7.0 | 7.0 | 7.0 | 444.0 |
      | 6 | 8.0 | 8.0 | 8.0 | 784.0 |
      | 7 | 9.0 | 7.0 | NaN | 954.0 |
      | 8 | NaN | NaN | NaN | 120.0 |
      +---+-------------+---------------+---------------+--------+




      This question is an exact duplicate of:




      • draw data in graph using random forest python [on hold]

        1 answer








      python pandas matplotlib machine-learning






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 27 '18 at 17:30









      dhilmathy

      1,3991917




      1,3991917










      asked Dec 27 '18 at 14:46









      user 123548

      13




      13




      marked as duplicate by desertnaut, jpp pandas
      Users with the  pandas badge can single-handedly close pandas questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Dec 27 '18 at 15:25


      This question was marked as an exact duplicate of an existing question.






      marked as duplicate by desertnaut, jpp pandas
      Users with the  pandas badge can single-handedly close pandas questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Dec 27 '18 at 15:25


      This question was marked as an exact duplicate of an existing question.


























          2 Answers
          2






          active

          oldest

          votes


















          1














          Have you tried the pandas plot function? I assume that you want a Bar chart, but more options exist.



          df.plot(x='destinationId', y='prices', kind='bar')


          enter image description here






          share|improve this answer





























            0














            df = df.set_index(1)


            Where 1 is a column number (destinationId in that case).



            Check documentation for more info:



            https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.set_index.html






            share|improve this answer








            New contributor




            Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              Have you tried the pandas plot function? I assume that you want a Bar chart, but more options exist.



              df.plot(x='destinationId', y='prices', kind='bar')


              enter image description here






              share|improve this answer


























                1














                Have you tried the pandas plot function? I assume that you want a Bar chart, but more options exist.



                df.plot(x='destinationId', y='prices', kind='bar')


                enter image description here






                share|improve this answer
























                  1












                  1








                  1






                  Have you tried the pandas plot function? I assume that you want a Bar chart, but more options exist.



                  df.plot(x='destinationId', y='prices', kind='bar')


                  enter image description here






                  share|improve this answer












                  Have you tried the pandas plot function? I assume that you want a Bar chart, but more options exist.



                  df.plot(x='destinationId', y='prices', kind='bar')


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 27 '18 at 14:50









                  Romain

                  6,14422136




                  6,14422136

























                      0














                      df = df.set_index(1)


                      Where 1 is a column number (destinationId in that case).



                      Check documentation for more info:



                      https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.set_index.html






                      share|improve this answer








                      New contributor




                      Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.























                        0














                        df = df.set_index(1)


                        Where 1 is a column number (destinationId in that case).



                        Check documentation for more info:



                        https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.set_index.html






                        share|improve this answer








                        New contributor




                        Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.





















                          0












                          0








                          0






                          df = df.set_index(1)


                          Where 1 is a column number (destinationId in that case).



                          Check documentation for more info:



                          https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.set_index.html






                          share|improve this answer








                          New contributor




                          Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          df = df.set_index(1)


                          Where 1 is a column number (destinationId in that case).



                          Check documentation for more info:



                          https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.set_index.html







                          share|improve this answer








                          New contributor




                          Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          share|improve this answer



                          share|improve this answer






                          New contributor




                          Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered Dec 27 '18 at 14:58









                          Anonymous

                          1




                          1




                          New contributor




                          Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.















                              Popular posts from this blog

                              Monofisismo

                              Angular Downloading a file using contenturl with Basic Authentication

                              Olmecas