Apr-13-2023, 05:08 PM
I can't wrap my head around this BBCode stuff right now. These are the actual columns and some of the data. I'll put the full coding below it.
SUBJID SAMPLEID BENCH WHO MIC1 BMD1 POS_CTRL1 NEG_CTRL3
MC_RUN_001 7305 Clinical Lefamulin LMU 0.125 . POS NEG
MC_RUN_001 7308 Clinical Lefamulin LMU 0.25 . POS NEG
MC_RUN_006 20490 Challenge Lefamulin LMU 0.125 . POS NEG
MC_RUN_006 20581 Challenge Lefamulin LMU <=0.015625 . POS NEG
#Reading the file:
folder = "exports"
filename = "RESULTS.xlsx"
fPath = project + "/" + folder + "/" + filename
print(fPath)
bmd_df.columns = map(lambda x: str(x).upper(), bmd_df.columns)
bmd_df=bmd_df[bmd_df['SAMPLEID'].isna()!=True]
bmd_df['SAMPLEID']=bmd_df['SAMPLEID'].astype(str)
bmd_df['MIC1']=bmd_df['MIC1'].astype(str)
bmd_df
----------------------------------------------------------------------------------------------------------------------------------
# Create a MIC variable (floating format) for the MIC
bmd_df['MIC_FLOAT'] = np.where(bmd_df['WHO']=='Lefamulin LMU',bmd_df['MIC1'].str.split().str[1],np.nan)
bmd_df['MIC_FLOAT'] = pd.to_numeric(bmd_df['MIC_FLOAT'], errors='coerce')
# Create a variable with the sign before the MIC, then create another variables for the ranges comparison (add 0.1 to the MIC > x)
bmd_df['MIC_SIGN']=np.where(bmd_df['WHO']=='Lefamulin LMU',bmd_df['MIC1'].str[0],None)
bmd_df['MIC_FOR_RANGES']=np.where(bmd_df['MIC_SIGN']=='>',bmd_df['MIC_FLOAT']+0.1,bmd_df['MIC_FLOAT'])
bmd_df=bmd_df.drop(['MIC_SIGN'], axis=1)
-----------------------------------------------------------------------------------------------------
SUBJID SAMPLEID BENCH WHO MIC1 BMD1 POS_CTRL1 NEG_CTRL3
MC_RUN_001 7305 Clinical Lefamulin LMU 0.125 . POS NEG
MC_RUN_001 7308 Clinical Lefamulin LMU 0.25 . POS NEG
MC_RUN_006 20490 Challenge Lefamulin LMU 0.125 . POS NEG
MC_RUN_006 20581 Challenge Lefamulin LMU <=0.015625 . POS NEG
#Reading the file:
folder = "exports"
filename = "RESULTS.xlsx"
fPath = project + "/" + folder + "/" + filename
print(fPath)
bmd_df.columns = map(lambda x: str(x).upper(), bmd_df.columns)
bmd_df=bmd_df[bmd_df['SAMPLEID'].isna()!=True]
bmd_df['SAMPLEID']=bmd_df['SAMPLEID'].astype(str)
bmd_df['MIC1']=bmd_df['MIC1'].astype(str)
bmd_df
----------------------------------------------------------------------------------------------------------------------------------
# Create a MIC variable (floating format) for the MIC
bmd_df['MIC_FLOAT'] = np.where(bmd_df['WHO']=='Lefamulin LMU',bmd_df['MIC1'].str.split().str[1],np.nan)
bmd_df['MIC_FLOAT'] = pd.to_numeric(bmd_df['MIC_FLOAT'], errors='coerce')
# Create a variable with the sign before the MIC, then create another variables for the ranges comparison (add 0.1 to the MIC > x)
bmd_df['MIC_SIGN']=np.where(bmd_df['WHO']=='Lefamulin LMU',bmd_df['MIC1'].str[0],None)
bmd_df['MIC_FOR_RANGES']=np.where(bmd_df['MIC_SIGN']=='>',bmd_df['MIC_FLOAT']+0.1,bmd_df['MIC_FLOAT'])
bmd_df=bmd_df.drop(['MIC_SIGN'], axis=1)
-----------------------------------------------------------------------------------------------------
buran write Apr-14-2023, 06:56 AM:
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.