Python Forum
deleting certain rows from multidimensional list
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
deleting certain rows from multidimensional list
#1


hello,

i am an half beginner with python 3.x
i uploaded a csv file ( here there is an example if someone wants to try) that contain coordinates and i converted it from string to float values, until here is simple.

data = list()

import csv
with open('data.csv', newline='') as csvfile:
    file = csv.reader(csvfile, delimiter=';', quotechar='"')
    for row in file:
        data.append(row[1:3])
        
    del data[0]#delete header
    
    for inner in data:
        for index, string in enumerate(inner):
            inner[index] = float(string)
            

    #print (data)
then i would like to delete the rows that contain a value under a certain amount in one of the columns. how could i do it? i am facing a lot of difficulties with multi dimensional array Doh

i tried for loops but i didn't manage to have it working
for row in data:
        print ("row: ", row)
        for element in row:
            print("ele: ", element)
Reply


Messages In This Thread
deleting certain rows from multidimensional list - by aster - Nov-02-2017, 03:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Deleting rows based on cell value in Excel azizrasul 11 2,758 Oct-19-2022, 02:38 AM
Last Post: azizrasul
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,652 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983
  deleting select items from a list Skaperen 13 4,674 Oct-11-2021, 01:02 AM
Last Post: Skaperen
  Pandas DataFrame combine rows by column value, where Date Rows are NULL rhat398 0 2,149 May-04-2021, 10:51 PM
Last Post: rhat398
  Indexing [::-1] to Reverse ALL 2D Array Rows, ALL 3D, 4D Array Columns & Rows Python Jeremy7 8 7,254 Mar-02-2021, 01:54 AM
Last Post: Jeremy7
  Deleting employee from list SephMon 3 3,321 Jan-05-2021, 04:15 AM
Last Post: deanhystad
  Counting Element in Multidimensional List quest_ 1 2,156 Nov-25-2020, 10:00 PM
Last Post: quest_
  Choose an element from multidimensional array quest_ 2 2,676 Nov-25-2020, 12:59 AM
Last Post: quest_
  Jelp with a multidimensional loop Formationgrowthhacking 1 1,879 Jan-27-2020, 10:05 PM
Last Post: micseydel
  Sort MULTIDIMENSIONAL Dictionary mirinda 2 4,945 Apr-05-2019, 12:08 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

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