Skip to content

Instantly share code, notes, and snippets.

@EdwinTai
Created September 16, 2020 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdwinTai/def03e63828ae074c1997fd15644a978 to your computer and use it in GitHub Desktop.
Save EdwinTai/def03e63828ae074c1997fd15644a978 to your computer and use it in GitHub Desktop.
3d use numpy && pandas
import numpy as np
import pandas as pd
samplesize = 100000
Probability = np.random.choice([0,1,2,3,4,5,6,7,8,9], size=samplesize, p=[0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1])
valueCount = pd.Series(Probability).value_counts()
print(valueCount/samplesize)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment