Reputation: 1527
I am new to python and have a pretty basic question. I am trying to reformat an excel sheet, the excel sheet has a specific cell with a value in it. I need to take this value and fill in a new column with it.
I have my data in Pandas and have found the specific cells location in the dataframe.
SpecificCell = df.iloc[0:1,11:12]
(im not sure this was the best way to do that though)
I have also created a new column in my dataframe and filled it with NAN.
DataFrame1['SpecificCellColumn'] = np.nan
Now I need to fill in the 'SpecifcCellColumn' with the value in SpecificCell. This is where I get stuck. I tried the following but it of course did not work.
DataFrame1.fillna(SpecificCell, inplace=True)
Any help is appreciated. How do I find a specific cell in a dataframes value then fill a new column with it.
Upvotes: 0
Views: 1129
Reputation: 8917
Why create an empty column and then fill it?
specific_cell = df.iloc[0,11]
df['SpecificCell'] = specific_cell
Upvotes: 0