Pandas Find Fifth Caracter In Field And Change Cell Based On That Number Code Example

Snippet 1

  df['col1'] = np.where(df['col1'] == 0, df['col2'], df['col1'])
df['col1'] = np.where(df['col1'] == 0, df['col3'], df['col1']) 

Snippet 2

  data['result'] = data['result'].map(lambda x: x.lstrip('+-').rstrip('aAbBcC'))
 

Copyright © Code Fetcher 2020

 

 

Leave a comment

Your email address will not be published. Required fields are marked *