User Tools

Site Tools


renamer
def renamer(x):
    if x == "iPhone":
        return 'mobile'
    else:
        return 'desktop'
 
df['Device_Type'].apply(matchtype)

with nan check

def define_segment(x):
    if pd.isnull(x) == True:
        return 'segment_1'
    else:
        return 'segment_2'
 
df['doi'] = df['doi'].apply(define_segment)
renamer.txt · Last modified: 2016/11/24 10:45 by vincenzo