My aim is to read a csv file and replace certain values corresponding to certain locations in the dataframe. Current code:
data = pd.read_csv(str(infilename), sep ='/t', header = None, skiprows = 2, index_col = None)
x = float((data.iloc[25].str.split(",", expand=True)[2]))-9000 #altering value
data.iloc[25].str.split(",", expand=True)[2]= x
print(data)
print(x)
out:
0 ------------------data------------------------
|
|
|
24 1,0.800,12161.31,8648.94,0.65,0.65,*BB,1.4061
25 2,0.883,1623669.24,656669.73,87.02,87.02,*BB,2...
26 3,1.388,143948.11,64119.45,7.71,7.71,*BB,2.2450
---------------------data------------------------
1614669.24
I'm not sure why the variable is not being replaced with the new one created?
csv data example: