Home > Net >  How to fill value from another column using pandas?
How to fill value from another column using pandas?

Time:02-01

I want to fill '0' value in another column value.

Data is like,

enter image description here

I want to fill '0.000000e 00' value with self_reported_market_cap and self_reported_circulating_supply columns.

So I'd tried,

condition1 = df_result['유통시총(조)'] == 0
condition2 = df_result['유통량(백만)'] == 0

df_result[condition1]['유통시총(조)']  = df_result[condition1]['self_reported_market_cap']
df_result[condition2]['유통시총(백만)']  = df_result[condition2]['self_reported_circulating_supply']

But, nothing happened.

CodePudding user response:

You should do like below:

df_result.loc[condition1,'유통시총(조)']  = df_result.loc[condition1,'self_reported_market_cap']
  • Related