Python Forum
[Solved] df.loc: write data in certain rows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] df.loc: write data in certain rows
#2
I found the solution:

# write data in column 'Comment', only for certain rows creates KeyError
df.loc[(df['Date_Time']  >= '2021-06-10 09:50:31')&(df['Date_Time']  < '2021-06-10 09:51:00'),'Comment']="zero" 
df
Reply


Messages In This Thread
RE: df.loc: write data in certain rows - by ju21878436312 - Jun-28-2021, 06:49 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how do you style data frame that has empty rows. gsaray101 0 524 Sep-08-2023, 05:20 PM
Last Post: gsaray101
  (Python) Pulling data from UA Google Analytics with more than 100k rows into csv. Stockers 0 1,217 Dec-19-2022, 11:11 PM
Last Post: Stockers
  How to properly format rows and columns in excel data from parsed .txt blocks jh67 7 1,874 Dec-12-2022, 08:22 PM
Last Post: jh67
  Write sql data or CSV Data into parquet file mg24 2 2,419 Sep-26-2022, 08:21 AM
Last Post: ibreeden
  Is this possible to write a script for checking data from website? WanW 2 1,115 Jun-02-2022, 02:31 AM
Last Post: Larz60+
  Write and read back data Aggie64 6 1,864 Apr-18-2022, 03:23 PM
Last Post: bowlofred
  [SOLVED] Concat data from dictionary? Winfried 4 1,718 Mar-30-2022, 02:55 PM
Last Post: Winfried
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,629 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983
  rows from sql query need to write to a file as columns sjcsvatt 6 2,383 Oct-09-2021, 12:45 AM
Last Post: snippsat
  Iterating Through Data Frame Rows JoeDainton123 2 2,906 Aug-09-2021, 07:01 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

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