Last active
October 2, 2020 07:55
-
-
Save MarkusMueller-DS/8f56433b3fd64ba68de0dbf690202a6c to your computer and use it in GitHub Desktop.
a for loop which saves the result of a sampling dist in a dict
This file contains hidden or 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
# from Udemy course: Data Science & Deep Learning for Business | |
# stratum_white and stratum_red are Data Frames | |
alcohol_per_wine_type = {} | |
for stratum, wine_type in [(stratum_white, 'white'), (stratum_red, 'red')]: | |
sample = stratum['alcohol'].sample(250, random_state = 0) # random sampling on each stratum | |
alcohol_per_wine_type[wine_type] = sample.mean() | |
print(alcohol_per_wine_type) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment