Last active
July 27, 2020 07:00
-
-
Save naenumtou/abe1ad2f978d82b4904f19478604e718 to your computer and use it in GitHub Desktop.
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
#Numpy where and select | |
s = time.time() | |
df['where'] = np.where(df['test'] < 50, 1, 0) | |
e = time.time() | |
print('where time = {}'.format(e-s)) | |
s = time.time() | |
df['select'] = np.select([df['test'] < 30, df['test'] < 50], [1,2], default = 3) | |
e = time.time() | |
print('Select time = {}'.format(e-s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment