I have a dataframe and want to replicate specific rows based on value in a column and looking for a simple way to do it. For example in the dummy data how can i replicate row where Age is 24 - 2 more times and where Age is 22 - 2 more times.
import pandas as pd
data= [['Karan',23],['Rohit',22],['Macron',22], ['Sahil',21],['Aryan',24]]
df = pd.DataFrame(data, columns=['Name','Age'])
So my final dataframe should look like [row order not important]
Name Age
Karan 23
Rohit 22
Rohit 22
Macron 22
Macron 22
Sahil 21
Aryan 24
Aryan 24
Tried [https://stackoverflow.com/questions/24029659/python-pandas-replicate-rows-in-dataframe] but no working for data with string.