1
submitted 3 months ago* (last edited 3 months ago) by [email protected] to c/[email protected]

Short version: So, the gist of this is that I want to truncate list by numerical value and can't seem to do it. I've been looking for solutions by myself for a bit, but since this project is a bit time sensitive and I am a total noob, I've come to you for help.

Long version: I have a data set from a poll, in which answers are coded by 1, 2, ..., 7, 99 with 99 being the value assinged to people who did not answer a particular question. The data was provided as a .csv file, from which I was able to extract the answers in form of a list of the form

data = [ [ 2.0, 3.0, ...] ],

thus a list, which contains the possible values as floats within a list. To solve this problem, I tried to remove the undesired 99 values using the list.remove command, however, since data is a list within a list, I can't use that command and for some reason, I can't use *data.remove(99.0) either, as starred expressions are not allowed. Any ideas how to either turn data into something like

data = [ 2.0, 3.0, ...]

so the list.remove command can do its magic or how to truncate data as it is?

Thank you in advance.

Edit: Thank you, Hexbear, for being a helpful community even to total scrubs who might ask redundant questions that can be solved by a quick google search!

no comments (yet)
sorted by: hot top new old
there doesn't seem to be anything here
this post was submitted on 28 Mar 2025
1 points (100.0% liked)

mutual_aid

21975 readers
63 users here now

Users cannot assume that any post has been vetted and must do their own investigation.

RULES:

  1. All mutual aid requests must go in this community.
  2. Mods do not vet individual mutual aid requests. Donate at your own risk.
  3. Do not request donations for funding anything explicitly illegal.
  4. Comments giving unsolicited advice will be removed. (See below)
  5. Comments or posts that are critical of any mutual aid post or user will be removed. (See below)
  6. Posts containing opsec leaks will be removed.

Additionally:

Moderator Pinning Rules:

founded 4 years ago
MODERATORS