I have the following dataframe:
d = pd.DataFrame([['A', 1989, 100],
['A', 1990, 200],
['A', 2017, 100],
['B', 1989, 500],
['B', 1990, 200],
['C', 1990, 200],
['C', 19870, 400]],
columns=['Univers', 'year', 'amount'])
Univer year amount
0 A 1989 100
1 A 1990 200
2 A 2017 100
3 B 1989 500
4 B 1990 200
5 C 1990 200
6 C 19870 400
.
.
.
I would like to perform a filter by Univer
. I applied only for A d2 = d[d['Univers']=='A']
:
Univers year amount
0 A 1989 100
1 A 1990 200
2 A 2017 100
Now, imagine I have a thousand of items in Univers
column (and their corresponding ítems in the dataframe), how can I do this for the remaining items in Univers
using a FOR
(or any other)?