i would like to use strings of "commands" to automate some pandas df analysis.
something like:
str_a = 'df.col_1.isna()'
str_b = ' & '
str_c = 'df.col_2.isna()'
str_tot = str_a + str_b + str_c
then use the string to sort out NaN rows in df:
df.loc[str_tot, :]
this last should be equal to:
df.loc[df.col_1.isna() & df.col_2.isna(), :]
but the python compiler reads the str_tot as a [list] and not as a string, returning error.
is there a way to circumvent this?
thx a lot
I am used to this in VBA a lot to build SQL strings... is it a wrong idea into python?