The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Change code to operators
Kumar_Ayush
Member Posts: 7 Learner I
in Help
def rm_main(data):
# Step 1: Get the last value in the "Time" column
data = pd.DataFrame(data)
last_time = data['Time-0-0'].iloc[-1]
# Step 2: Convert "Time" to timedelta and subtract last_time from each value in "End_Date_Time"
data["Time_Stamp"] = data.apply(lambda row : datetime.strptime(row["End_Date_Time"],"%Y/%m/%d %H:%M:%S")- timedelta(minutes=last_time),axis=1)
# Step 3: Iterate through all the rows and add "Time" to "Time_stamp"
data["Time_Stamp"] = data.apply(lambda row : row["Time_Stamp"] + timedelta(minutes=row['Time-0-0']),axis=1)
data["Time_Stamp"] = data["Time_Stamp"].apply(lambda x: x.replace(microsecond=0))
data["Time_Stamp"] = data["Time_Stamp"] - timedelta(hours=5, minutes=30)
return data
0
Answers
Dortmund, Germany