0

I have two Series and one function which depends of two variables:

import pandas as pd

solar_radiation = pd.Series([0,0,0,0,100,300,500,400,300,200,0])
velocity = pd.Series([10,20,5,3,2,1,3,10,3,4,1])

def Pasqul_stability(solar_radiation,velocity):
    if solar_radiation<1:
        return "stable"
    elif solar_radiation>1   and solar_radiation<350 and velocity>5:
        return "stable"
    elif solar_radiation>350 and solar_radiation<750 and velocity>6:
        return "stable"
    else:
        return "unstable"

I want to get one series after function:

stablity = ['stable','stable','stable','stable','unstable','unstable','unstable','unstable','unstable','stable']

when I try to use

stablity=Pasqul_stability(solar_radiation,velocity)

I get an error. How should I solve my problem?

1 Answers1

0

You may try this:

stability = []
for SR, V in zip(solar_radiation, velocity):
    stability.append(Pasqul_stability(SR, V))

print(stability)

['stable', 'stable', 'stable', 'stable', 'unstable', 'unstable', 'unstable', 'stable', 'unstable', 'unstable', 'stable']
ats
  • 141
  • 6