Created
July 12, 2021 08:06
-
-
Save hyunsikhwang/1f302e44e89bec13e8e5b2d0764c6241 to your computer and use it in GitHub Desktop.
#KCD #code #extract #range #comma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ext_KCD(df_KCD, input_KCD): | |
KCD_1 = input_KCD.replace(' ', '').split(',') | |
KCD_list = [] | |
for KCD in KCD_1: | |
if "-" in KCD: | |
KCD_beg = KCD.split('-')[0].upper() | |
KCD_end = KCD.split('-')[1].upper() | |
KCD_list = KCD_list + df_KCD[(df_KCD>=KCD_beg) & (df_KCD<=KCD_end)].unique().tolist() | |
else: | |
KCD_list.append(KCD.upper()) | |
return KCD_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment