how could i delete rows with repeating/duplicate index from dataframe

pratish_v

I have a dataframe

>>> df
zeroa  zerob zeroc zerod zeroe zero
FSi                                     
1       10    100     a    ok   NaN   ok
1       11    110        temp   NaN  NaN
2       12    120     c  temp   NaN  NaN
3      NaN    NaN   NaN   NaN    ok  NaN

I want to keep only unique indexes, as index 1 is repeating I want its second instance to be dropped, how could I do that ? I want my result as

>>> df
     zeroa  zerob zeroc zerod zeroe zero
FSi                                     
1       10    100     a    ok   NaN   ok
2       12    120     c  temp   NaN  NaN
3      NaN    NaN   NaN   NaN    ok  NaN
IanS

Without resetting the index:

df[~df.index.duplicated()]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How delete rows from dataframe after comparison

From Dev

Delete rows from pandas DataFrame with non-unique index

From Dev

How could I use boolean index to retrieve columns of a pandas DataFrame

From Dev

Delete grouped rows from a dataframe

From Dev

How can I delete rows for a particular Date in a Pandas dataframe?

From Dev

How do I delete rows within a subset of a dataframe

From Dev

How to delete all rows in a dataframe?

From Dev

How to select consecutive rows from a multi-index pandas dataframe?

From Dev

How could I get columns that meet a condition from a dataframe in pyspark?

From Dev

How can I delete two rows from a self-join

From Dev

How can i delete from the database multiple rows using a checkbox?

From Dev

How can I delete rows from two tables?

From Dev

How can I delete rows from a set range object

From Dev

How do I delete multiple rows from a table on Backand?

From Dev

How can I delete multply rows from a table with another condition?

From Dev

Delete rows from python panda dataframe

From Dev

How do I get the name of the rows from the index of a data frame?

From Dev

How to del DataFrame useless rows, make the useful rows index from 0?

From Dev

Delete and index and associated data from a pandas dataframe

From Dev

How do I substract a value from a column in a dataframe, with unique rows

From Dev

Remove certain rows from dataframe based on index

From Dev

How could I do this trigger delete with validations

From Dev

How can I retrieve a row by index value from a Pandas DataFrame?

From Dev

How can I delete all rows of a DataFrame that have an NA in a specific column?

From Dev

Delete rows from dataframe is column value does not exist in another dataframe

From Dev

How could I safely delete the Desktop folder icon from my Home folder?

From Dev

How to delete some rows with comments from a CSV file to load data to DataFrame?

From Dev

How to select the not null rows from another dataframe and take randomly its index

From Dev

How to merge pandas dataframes while removing rows from first dataframe which have the same index?

Related Related

  1. 1

    How delete rows from dataframe after comparison

  2. 2

    Delete rows from pandas DataFrame with non-unique index

  3. 3

    How could I use boolean index to retrieve columns of a pandas DataFrame

  4. 4

    Delete grouped rows from a dataframe

  5. 5

    How can I delete rows for a particular Date in a Pandas dataframe?

  6. 6

    How do I delete rows within a subset of a dataframe

  7. 7

    How to delete all rows in a dataframe?

  8. 8

    How to select consecutive rows from a multi-index pandas dataframe?

  9. 9

    How could I get columns that meet a condition from a dataframe in pyspark?

  10. 10

    How can I delete two rows from a self-join

  11. 11

    How can i delete from the database multiple rows using a checkbox?

  12. 12

    How can I delete rows from two tables?

  13. 13

    How can I delete rows from a set range object

  14. 14

    How do I delete multiple rows from a table on Backand?

  15. 15

    How can I delete multply rows from a table with another condition?

  16. 16

    Delete rows from python panda dataframe

  17. 17

    How do I get the name of the rows from the index of a data frame?

  18. 18

    How to del DataFrame useless rows, make the useful rows index from 0?

  19. 19

    Delete and index and associated data from a pandas dataframe

  20. 20

    How do I substract a value from a column in a dataframe, with unique rows

  21. 21

    Remove certain rows from dataframe based on index

  22. 22

    How could I do this trigger delete with validations

  23. 23

    How can I retrieve a row by index value from a Pandas DataFrame?

  24. 24

    How can I delete all rows of a DataFrame that have an NA in a specific column?

  25. 25

    Delete rows from dataframe is column value does not exist in another dataframe

  26. 26

    How could I safely delete the Desktop folder icon from my Home folder?

  27. 27

    How to delete some rows with comments from a CSV file to load data to DataFrame?

  28. 28

    How to select the not null rows from another dataframe and take randomly its index

  29. 29

    How to merge pandas dataframes while removing rows from first dataframe which have the same index?

HotTag

Archive