Python Forum
How to modify df column
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to modify df column
#2
Since the third row in your example is the 2nd row of data and that Python indices are zero-based, you can slice the dataframe using [1:] as done here:
print(df)
df.loc[1:, 'Design'] = df.loc[1:, 'Design'] + ':POJK:WAT'
print(df)
Output:
Category Design Name Rank 0 Group2 UIK DUT 5 1 Group1 TYAHU HYT 1 2 Group1 JKAL PAT 2 3 Group3 PLK JKL 3 Category Design Name Rank 0 Group2 UIK DUT 5 1 Group1 TYAHU:POJK:WAT HYT 1 2 Group1 JKAL:POJK:WAT PAT 2 3 Group3 PLK:POJK:WAT JKL 3
Reply


Messages In This Thread
How to modify df column - by SriMekala - Aug-14-2019, 02:43 PM
RE: How to modify df column - by boring_accountant - Aug-14-2019, 11:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to modify and save a column in the sqlite3 database using python? laithsky1 3 2,810 Dec-18-2018, 03:39 AM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020