Skip to content Skip to sidebar Skip to footer

Amend Column Values According To Timedelta And Index

I would like to change my data in a pandas dataframe. The data I collect needs to be assigned a step value. The conditions of what triggers a step change are occasionally time or h

Solution 1:

Try this

df['press'].astype('float')
df['temp'].astype('float')

df['proc']  = np.where((df['press'] > 1100) & (df['temp'] < 40),'dilute', "pressurized")

Solution 2:

use .loc instead of .ix

df.loc[(df.press > 1100) & (df.temp < 40), 'proc'] = 'dilute'

Post a Comment for "Amend Column Values According To Timedelta And Index"