Python Forum
How to remove some elements from an array in python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to remove some elements from an array in python?
#6
(Nov-28-2023, 12:18 AM)rob101 Wrote: This is because you're altering the list object as you iterate over it. The way that I would do this is to have your .remove() loop compile a list of values that need to be removed, than use that list to find and remove the values from the sorted_MD_list.

Thank you.
rob101 likes this post
Reply


Messages In This Thread
RE: How to remove some elements from an array in python? - by gohanhango - Nov-28-2023, 02:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  unable to remove all elements from list based on a condition sg_python 3 1,832 Jan-27-2024, 04:03 PM
Last Post: deanhystad
  ValueError: Length mismatch: Expected axis has 8 elements, new values have 1 elements ilknurg 1 8,626 May-17-2022, 11:38 AM
Last Post: Larz60+
  Replace elements of array with elements from another array based on a third array Cola_Reb 6 5,789 May-13-2022, 06:06 PM
Last Post: deanhystad
Question Change elements of array based on position of input data Cola_Reb 6 3,631 May-13-2022, 12:57 PM
Last Post: Cola_Reb
  Indexing [::-1] to Reverse ALL 2D Array Rows, ALL 3D, 4D Array Columns & Rows Python Jeremy7 8 10,426 Mar-02-2021, 01:54 AM
Last Post: Jeremy7
  Sorting Elements via parameters pointing to those elements. rpalmer 3 3,607 Feb-10-2021, 04:53 PM
Last Post: rpalmer
  4D array with only elements on one side of the diagonal schniefen 0 2,237 Dec-24-2020, 11:32 AM
Last Post: schniefen
  Removing some elements from array based on a condition claw91 0 2,210 Oct-27-2020, 03:42 PM
Last Post: claw91
  Remove specific elements from list with a pattern Xalagy 3 3,763 Oct-11-2020, 07:18 AM
Last Post: Xalagy
  remove elements method not working spalisetty06 4 3,615 Aug-13-2020, 01:17 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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