Oct-16-2020, 09:41 PM
(Oct-03-2020, 04:06 AM)buran Wrote: can you provide sample dataframe (no need of 60 000 rows, just 2-3 rows is sufficient)
Ideal would be to provide a code that creates a DataFrame with the same structure as yours - like I did in my example which works.
Hi buran
My apologies for not getting back to you sooner.
I have tried several ways to get your method of looping through the data however I still cannot get it to work and I dont understand why.
I have re-created the data set along with the code you suggested which is:-
import pandas raw_data = pandas.DataFrame(columns=["Column_0", "Column_1", "Column_2", "Column_3", "Column_4", "Column_5", "Column_6", "Column_7", "Column_8"]) raw_data.loc[0,:] = ("315589", "CHZ3", "1100", "218", "694.63", "nan", "-1.589", "0", "1.3694") raw_data.loc[1,:] = ("364048", "CHZ3", "1100", "320", "12.09", "nan", "-7.216", "0", "59.89") raw_data[5] = raw_data[3] * 8950 + raw_data[4] #raw_data.iloc[:,5] = raw_data.iloc[:,3] * 8950 + raw_data.iloc[:,4]If you run the code as it is you will see that i get an error if i follow your method, however if comment out the code you suggested and uncomment out the last line it works fine.
But i want to understand why your suggestion does not work?
I think i am going crazy?
Thank you.