I have a data frame like in the figure.
I have multiple id with different columns.
I want to build another dataframe that only has the distinct id and also the dataframes has all the columns for that id.
could you help me with that? Thank you so much
import pandas as pd
import numpy as np
df = pd.DataFrame()
df['id'] = [2, 3, 3,2,1]
df['c2'] = [1, 10, 6, 7, 4]
df['c3'] = [11, 23, 9, 10,23]
print(df)
dfn = pd.DataFrame()
dfn['id'] = [2, 3,1]
dfn['c2'] = [1, 10, 4]
dfn['c3'] = [11, 23, 23]
dfn['c4'] = [7, 6, 0]
dfn['c5'] = [10, 9, 0]
dfn
The first one is that I have and the second one is that I want