I have a big dataframe like this with millions rows. I want to do something to apply to this dataframe quickly.
df value
10
-1
20
...
-3
-4
-50
12
I want to know the most efficient way to determine if the value is greater than 0, the value will * 2. If the value is less than 0, the value will *3. The output will be the dataframe like this
df value
20
-3
40
...
-9
-12
-150
24
my script is
dff = df.value
for i in range(len(dff)):
if dff[i] > 0:
dff[i] = dff[i] * 2
elif dff[i] < 0:
dff[i] = dff[i] * 3