Tomasz Kania
• Member for 12 years, 11 months
• Last seen this week
• Praha & Kraków
Stats
16,553
reputation
315k
reached
399
44
questions
Communities
View all

Researcher at the Czech Academy of Sciences.

• Banach spaces and their operators; geometry of Banach spaces;
• Ideals and representations of operator algebras and, more generally, Banach algebras;
• Applied Probability, Financial markets, Python modelling.

import pandas as pd

# Merging df1 and df2 on GFCID and period

df_merged = pd.merge(df1, df2[['GFCID', 'period']], on=['GFCID', 'period'], how='left', indicator=True)

# Adding the def_flag column based on the conditions

df1['def_flag'] = ( (df_merged['_merge'] == 'both') | # Condition 1: GFCID and period values match (df1['ORR'].isin(["9", "9-", "10"])) | # Condition 2a: ORR is in the list ["9", "9-", "10"] (df1['Baseline_ORR_orig'].isin(["9", "9-", "10"])) # Condition 2b: Baseline_ORR_orig is in the list ["9", "9-", "10"] ).astype(int)

# Drop the temporary '_merge' column if needed

df_merged.drop(columns=['_merge'], inplace=True)

# The final DataFrame df1 now contains the 'def_flag' column

1
35
75
749
Score
247
Posts
56
Posts %
483
Score
157
Posts
35
Posts %
162
Score
71
Posts
16
Posts %
125
Score
46
Posts
10
Posts %
121
Score
54
Posts
12
Posts %
105
Score
48
Posts
11
Posts %
Top posts
32
Oct 10, 2014
22
Nov 25, 2016
21
Apr 14, 2015
18
May 6, 2015
15
Jul 12, 2014
12
Dec 8, 2016
12
Dec 23, 2020
11
Nov 18, 2014
11
Apr 6, 2017
Top network posts
View all network posts