Last active
May 25, 2020 23:16
-
-
Save Olshansk/b7d1c569f5a436b453438de88663cae5 to your computer and use it in GitHub Desktop.
Transition Matricies - Bucketize Data
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
NUM_BINS = 10 | |
bins = np.linspace(0, 100, NUM_BINS + 1) | |
# Note: we set include_lowest to true to make sure that we include zeroes | |
bucket_GT = pd.cut(grades_GT, bins=bins, include_lowest=True, right=True) | |
bucket_P = pd.cut(grades_P, bins=bins, include_lowest=True, right=True) | |
# Output of the cut function | |
pd.DataFrame({'grades': grades_GT, 'bucket': bucket_GT}).head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment