Given the following dataframe In [8]: val_1 = np. random.normal(loc = 10, scale=3, size=1000 ) val_2 = np.random.choice(
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Given the following dataframe In [8]: val_1 = np. random.normal(loc = 10, scale=3, size=1000 ) val_2 = np.random.choice(
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!