I need to derive a new column from existing column in dataframe. this logic will be different for different runs. For this, I have decided to have a config file so that logic can be updated in config file easily.
logic_Entry in config file:
df['col1'].str[1:4]
used in code like below:
df['col2']= logic_Entry
but when I check the output in col2 it just puts the logic as a literal, so in this example I get value as df['col1'].str[1:4] for all records.
I was expecting it to instead evaluate this logic and put substring of col1
in this new column (col2
).
Can someone please suggest what am I missing?