Python Forum
Dropping Rows From A Data Frame Based On A Variable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dropping Rows From A Data Frame Based On A Variable
#1
Hi all

I have a data frame which i want rows to be removed.

I am using the command:-

data_frame_current.drop(index=b)
b is a variable that increments which represents the row.

So i want to remove the row that has the index b.

But this does not work, but has not errors.

Can anyone point me in the right direction please?

Thank you
Reply
#2
What behavior did you expect? May be you forgot to set inplace=True? data_frame_current.drop(index=b, inplace=True).
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Grouping in pandas/multi-index data frame Aleqsie 3 606 Jan-06-2024, 03:55 PM
Last Post: deanhystad
  Merging rows and adding columns based on matching index pythonnewbie78 3 748 Dec-24-2023, 11:51 AM
Last Post: Pedroski55
  Filtering Data Frame, with another value NewBiee 9 1,329 Aug-21-2023, 10:53 AM
Last Post: NewBiee
  Supervised learning, tree based model - problems splitting data Pixel 0 643 May-16-2023, 05:25 PM
Last Post: Pixel
  Grouping Data based on 30% bracket purnima1 0 940 Feb-16-2023, 07:14 PM
Last Post: purnima1
  Make unique id in vectorized way based on text data column with similarity scoring ill8 0 861 Dec-12-2022, 03:22 AM
Last Post: ill8
  Pandas Dataframe Filtering based on rows mvdlm 0 1,396 Apr-02-2022, 06:39 PM
Last Post: mvdlm
  Exporting data frame to excel dyerlee91 0 1,604 Oct-05-2021, 11:34 AM
Last Post: dyerlee91
  Pandas Data frame column condition check based on length of the value aditi06 1 2,655 Jul-28-2021, 11:08 AM
Last Post: jefsummers
  Adding a new column to a Panda Data Frame rsherry8 2 2,082 Jun-06-2021, 06:49 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020