Jun-22-2019, 10:16 PM
Hi everyone,
I am a SAS user and it has a very useful function call substr. I cannot find an equivalent for Pandas or Python.
I am trying to sum a variable where another string variables first two letters = '08'
my attempt is below:
Any help is appreciated
Thanks
I am a SAS user and it has a very useful function call substr. I cannot find an equivalent for Pandas or Python.
I am trying to sum a variable where another string variables first two letters = '08'
my attempt is below:
data.loc[data.Hs_code[0:1] == '08'].Imports_vfd.sum()My error:TypeError: invalid type comparison
Any help is appreciated
Thanks