Given the following dataframe In [8]: val_1 = np. random.normal(loc = 10, scale=3, size=1000 ) val_2 = np.random.choice(
Posted: Sun May 15, 2022 11:57 am
Given the following dataframe In [8]: val_1 = np. random.normal(loc = 10, scale=3, size=1000 ) val_2 = np.random.choice(['Chocolate', 'Icecream', 'Apple'], size=len(val_1), replace=True) df = pd. DataFrame({'X':val_1, 'y':val_2}) df Out[8]: x у 0 7.263616 Chocolate 1 9.295601 Icecream 2 6.871386 Icecream 3 6.059927 Chocolate 4 5.574106 Chocolate 995 6.355084 Icecream 996 6.919248 Chocolate 997 8.750277 Icecream 998 9.305044 Icecream 999 3.464517 Chocolate 1000 rows x 2 columns Drop all rows that the index is a factor of 7