0
Follow
0
View

็How to multiply specific range of data in dataframe python

dreamwing0324 注册会员
2023-01-25 22:56

You can do loc(assume the index is from 0 to n-1 , if not df.reset_index(drop=True, inplace=True) before below)

dataframe.loc[2:,'Energy Consumption'] *= 0.3
dataframe
   Energy Consumption
0                20.0
1                21.0
2                 5.7
3                 5.4
4                 7.5
5                12.0
6                 5.4

About the Author

Question Info

Publish Time
2023-01-25 22:56
Update Time
2023-01-25 22:56