DKM
DKM

Reputation: 1801

Pandas Data Frame Select column last value and replace with blank

I have a data frame with lots of columns, I wanted to replace the last value of few of columns with blank, what is the best way to do that.

the thing is data frame can be dynamic with values and length.

Here is the data frame:

enter image description here

How can I remove values from column F and G to blank?

please except typos as I'm new here.

Upvotes: 0

Views: 52

Answers (1)

iDrwish
iDrwish

Reputation: 3103

df.loc[df.index[-1], ['G', 'F']] = np.nan

Upvotes: 1

Related Questions