Skip to content

Tag: python

convert multiple units to KG in pandas

let’s say i have this code(which is obviously wrong) I want to apply such condition to each value in a column(weights) based on another column(weight unit). Is there an efficient way to do it. Preferably allowing a func pass so easy to modify Answer Don’t use a function, this will be slow. numpy.v…

if statement for columns in 2D list

I need to iterate two different lists of integers with an if-statement that requires a mathematic operation. I’ve approached this in several ways, the latest one shown below. I have 4 lists that I’ve extracted from columns in a CSV file: I need to identify the names for those competitors who are o…

Regex Match on String (DOI)

Hi I’m struggling to understand why my Regex isn’t working. I have URL’s that have DOI’s on them like so: And I’m using for example this Regex, but it always returns empty? Where have I gone wrong? Answer It looks like you come from another programming language that has the notio…