Skip to content

Tag: pandas

New column in dataset based em last value of item

I have this dataset I want to add a new column in dataset based em last value of item, like this A New Column 1 2 1 3 2 4 3 5 4 I tryed to use apply with iloc, but it doesn’t worked Can you help Thank you Answer With your shown samples, could you please try following. You

set an index while merging two dataframe

I have a dataframe like this : dte res year 1995-01-01 65.3 1995 1995-01-02 65.5 1995 … … … 2019-01-03 55.2 2019 2019-01-04 52.2 2019 and I’m trying to create another file in this format : basically I want every year in a different column. Here is what I already did : when I write in m…