Relative Content

Tag Archive for pythonpandasdataframein-placedrop-duplicates

Why does drop_duplicates in_place = True not work in this case? [duplicate]

This question already has answers here: pandas chaining and the use of “inplace” parameter (2 answers) Closed 15 days ago. Sample data: data = [[1, ‘[email protected]’], [2, ‘[email protected]’], [3, ‘[email protected]’]] person = pd.DataFrame(data, columns=[‘id’, ’email’]).astype({‘id’:’int64′, ’email’:’object’}) Reproducible code: (person.sort_values(by = [’email’, ‘id’], ascending = [True, True]) .drop_duplicates(subset = ’email’, keep = ‘first’, inplace = True)) […]