I have a first df as this:
Date(UTC) Pair Side Price Executed Amount Fee
2021-01-18 00:16:33 ADAUSDT BUY 0.387870 120.1000000000ADA 46.58318700 0.000755330
2021-01-16 00:35:50 LINKUSDT BUY 21.924700 0.9100000000LINK 19.95147700 0.000361620
and I'm trying to create a second df importing the data from the first df. In the image you can se the logic that I want, and where I got so far.Image
Code:
d={'Pair':[],'Medium Price':[],'Total Amount':[],'Total Value':[]}
df2= pd.DataFrame(data=d)
def add_pair(pair):
if pair not in df2['Pair']:
df2['Pair']=pair
df2['Pair']=df['Pair'].apply(add_pair)
df2