Closed bandersen23 closed 4 years ago
Thank you for the pull request!
However I will say this feels a little odd to me. Do other similar libraries provide such a function?
I haven’t found any other libraries that have this feature either in my research and since it’s not a standard feature it’s probably worth closing this PR. Thank you for replying though!
I'm not saying no outright, I just need some convincing. Perhaps you could show a code snippet where this makes things simpler? I'm also fine if you decide to close this.
Used when taking data that might (or may not) have a checksum and dropping the digit to query databases that choose not to include checksum digits. I should add a commit that returns just the string if no luhn checksum value present.
def drop(string):
"""
returns string minus checksum value if checksum exists
"""
if verify(string):
return string[:-1]
else:
return string
# dataset with multiple columns (df)
# some with luhn checksum (df['a'])
# some without luhn checksum (df['b'])
# need to query fields in another dataset without checksums entirely
my_values = pd.concat([df['a'], df['b'])
my_values = my_values.apply(drop)
# query other dataset now with all normalized values
For context we also use luhn.append
to add checksums when we have values from databases that don't contain checksum and look in ones that do.
This way I can just drop it if I no longer need the checksum rather than check if it was there.