Skip to content
Advertisement

how to subtract two values in my dataframe

I get this csv from my program and i want to get the “thickness”/difference of each of my Depth values. So for example 3998 - 4002 = -4 is there a way to use this csv or is it useless because i couldn’t find anything that would solve my problem.

df = pd.read_csv ('/PermeabilityData.csv',sep=";") 
display(df)

a = df['Depth [ft]'].loc[data.index[0]]
    Depth [ft]  Permeability [mD]
0   3998-4002   180
1   4002-4004   150
2   4004-4006   200
3   4006-4008   140
4   4008-4010   160

Advertisement

Answer

This could also be done:

pd.eval(df.iloc[:,0])

[-4, -2, -2, -2, -2]
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement