How can I convert back? [duplicate]












0
















This question already has an answer here:




  • Pandas reverse of diff()

    1 answer




I converted my timeseries into stationary time series with differentiation



data['consumption_diff'] = data.consumption-data.consumption.shift(1) 


How can I convert consumption_diff back into consumption?










share|improve this question















marked as duplicate by jpp python
Users with the  python badge can single-handedly close python 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();
}
);
});
});
Nov 26 '18 at 16:19


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    0
















    This question already has an answer here:




    • Pandas reverse of diff()

      1 answer




    I converted my timeseries into stationary time series with differentiation



    data['consumption_diff'] = data.consumption-data.consumption.shift(1) 


    How can I convert consumption_diff back into consumption?










    share|improve this question















    marked as duplicate by jpp python
    Users with the  python badge can single-handedly close python 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();
    }
    );
    });
    });
    Nov 26 '18 at 16:19


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      0












      0








      0









      This question already has an answer here:




      • Pandas reverse of diff()

        1 answer




      I converted my timeseries into stationary time series with differentiation



      data['consumption_diff'] = data.consumption-data.consumption.shift(1) 


      How can I convert consumption_diff back into consumption?










      share|improve this question

















      This question already has an answer here:




      • Pandas reverse of diff()

        1 answer




      I converted my timeseries into stationary time series with differentiation



      data['consumption_diff'] = data.consumption-data.consumption.shift(1) 


      How can I convert consumption_diff back into consumption?





      This question already has an answer here:




      • Pandas reverse of diff()

        1 answer








      python python-3.x pandas series






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 16:20









      jpp

      100k2162111




      100k2162111










      asked Nov 26 '18 at 15:46









      Nikita PolozokNikita Polozok

      183




      183




      marked as duplicate by jpp python
      Users with the  python badge can single-handedly close python 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();
      }
      );
      });
      });
      Nov 26 '18 at 16:19


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by jpp python
      Users with the  python badge can single-handedly close python 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();
      }
      );
      });
      });
      Nov 26 '18 at 16:19


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          You can use numpy's "r_" object which concatenates and flattens arrays and the "cumsum()" function which cumulatively sums values.



          import numpy as np
          undiffed = np.r_[data.consumption.iloc[0], data.consumption_diff.iloc[1:]].cumsum()


          That is how you can undiff timeseries data and can be helpful if you've done a prediction into future dates that you need to undiff. However, you already have the undiffed values: data.consumption are your original undifffed data.






          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You can use numpy's "r_" object which concatenates and flattens arrays and the "cumsum()" function which cumulatively sums values.



            import numpy as np
            undiffed = np.r_[data.consumption.iloc[0], data.consumption_diff.iloc[1:]].cumsum()


            That is how you can undiff timeseries data and can be helpful if you've done a prediction into future dates that you need to undiff. However, you already have the undiffed values: data.consumption are your original undifffed data.






            share|improve this answer




























              0














              You can use numpy's "r_" object which concatenates and flattens arrays and the "cumsum()" function which cumulatively sums values.



              import numpy as np
              undiffed = np.r_[data.consumption.iloc[0], data.consumption_diff.iloc[1:]].cumsum()


              That is how you can undiff timeseries data and can be helpful if you've done a prediction into future dates that you need to undiff. However, you already have the undiffed values: data.consumption are your original undifffed data.






              share|improve this answer


























                0












                0








                0







                You can use numpy's "r_" object which concatenates and flattens arrays and the "cumsum()" function which cumulatively sums values.



                import numpy as np
                undiffed = np.r_[data.consumption.iloc[0], data.consumption_diff.iloc[1:]].cumsum()


                That is how you can undiff timeseries data and can be helpful if you've done a prediction into future dates that you need to undiff. However, you already have the undiffed values: data.consumption are your original undifffed data.






                share|improve this answer













                You can use numpy's "r_" object which concatenates and flattens arrays and the "cumsum()" function which cumulatively sums values.



                import numpy as np
                undiffed = np.r_[data.consumption.iloc[0], data.consumption_diff.iloc[1:]].cumsum()


                That is how you can undiff timeseries data and can be helpful if you've done a prediction into future dates that you need to undiff. However, you already have the undiffed values: data.consumption are your original undifffed data.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 '18 at 16:15









                Ollie in PGHOllie in PGH

                1,2501915




                1,2501915

















                    Popular posts from this blog

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)