Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13951

Updated dataframe - keep the last update - dataframe pandas

$
0
0

I have a dataframe which contains the following values :

In[17]: dfOut[17]:          maj       date  value0 2006-01-19 2006-01-22   0.951 2006-01-20 2006-01-22   0.032 2006-01-21 2006-01-22   0.283 2006-01-22 2006-01-22   0.985 2006-01-20 2006-01-23   0.146 2006-01-21 2006-01-23   0.047 2006-01-22 2006-01-23   0.108 2006-01-23 2006-01-23   0.139 2006-01-24 2006-01-23   0.13

I want to obtain by a function the last update of each date (here 2006-01-24 for 2006-01-23 and 2006-01-22 for 2006-01-22). We doesn't know in advance the number of days which separe the date from the maj, but we need to have the last maj for each date) :

In[17]: dfOut[17]:          maj       date  value3 2006-01-22 2006-01-22   0.989 2006-01-24 2006-01-23   0.13

Someone have an idea on how to perform it ?


Viewing all articles
Browse latest Browse all 13951

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>