Generation

generate functionThu, 16 Feb 2023

Write a function that finds all object, string values in a Pandas dataframe column 'values'

def object_finder(row): if type(row['values']) == str or type(row['values']) == list: return row['values'] else: return None df['object'] = df.apply(object_finder, axis=1)

Questions about programming?Chat with your personal AI assistant