I have a dataframe with columns ['ID', 'DATE', 'VALUE']. The way that the data I am sourcing comes in, I have many duplicate IDs, each of which has a duplicate price--so, for instance, the frame will come in with
ID Date Value
a 1/1/17 2
a 1/2/17 3
a 1/3/17 4
b 1/1/17 5
b 1/2/17 6
b 1/2/17 7
I have made a frame where the date is the index, and unique IDs are the columns, via
ID = list(set(df['ID']))
DATE = list(set(df['DATE']))
newdf = pd.DataFrame(columns = ID, index = DATE).sort()
I now want to retrieve the Value from df, and place it so that newdf[DATE][ID] matches up with the those indices from df, and I can't figure out how to cast those without some onerous for loops--is there a better way?