Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def clean_seat(x):
'''
input is a string object and not a list
'''
# a = [float(sing_price) for price in x for sing_price in price.split(",")]
# a = [sing_price for price in x for sing_price in price.split(",")]
# return sum(a)/len(a)
a = [float(price) for price in x.split(",")]
return sum(a)/len(a)
def average_s1_s2_price(s1, s2):
'''
pandas series as input
for price 1 and price 2 all 4 combination covered.
'''
price_output = []
# for i in range(len(s1)):
if (s1 == 0) & (s2 == 0):
return 0
elif (s1 == 0) & (s2 !=0 ):
return s2
elif (s1 != 1) & (s2 ==0 ):
return s1
else :
return (s1+s2)/2
# return price_output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment