I got a csv-file containing names and income. Some names are shown multiple times. I wanted to merge these to get only 1 unique name each with the income next to it using Pandas.
I thought pivot would be the solution for my problem. I tried the following:
df = pd.read_csv("properties.csv")
df = df.iloc[1:]
df = pd.DataFrame(df, columns= ['income', 'names'])
df['source'] = df['income'].astype(int)
test = pd.pivot_table(df, index='names', values='income')
What the problem is that I would like to numbers itself rather than the average.
For example:
name1: 2,3,2,3
name2: 1,2,4,1
Instead of:
name1: 2.5
name2: 2