<jupyter_start><jupyter_text>permutations/combinations `n` is the number of things to choose from, and we choose `r` of them PERMUTATIONS (order matters)- Repetition is Allowed: such as a lock. It could be "333".     `= n^r`     - No Repetition: for example the first three people in a running race. You can't be first and second.     `= n!/(n − r)!`  COMBINATIONS (order doesn't matter)- Repetition is Allowed: such as coins in your pocket (5,5,5,10,10)      `= (r+n-1)!/(r!*(n − 1)!)` - No Repetition: such as lottery numbers (2,14,15,27,30,33)      `= n!/(r!*(n − r)!)`<jupyter_code>import math
f = math.factorial
def permutation_repetition(n, r): # such as a lock, it could be "333"
    return n^r

def permutation_no_repetition(n, r): # for example the first three people in a running race. You can't be first and second.
    return f(n)/f(n-r)

def combination_repetition(n, r):  # such as coins in your pocket (5,5,5,10,10)
    return f(r+n-1)/(f(r)*f(n-1))

def combination__no_repetition(n, r):  # such as lottery numbers (2,14,15,27,30,33)
    return f(n)/(f(r)*f(n-r))

print('ans =', permutation_no_repetition(13, 3))<jupyter_output>ans = 1716.0<jupyter_text>probability plot<jupyter_code>import numpy
from scipy import stats
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd

data = numpy.random.random((100,1))
data.sort(0)
data_standardized = (data - data.mean())/data.std()  # already sorted

# alternatively, can use zscore function, does the same standardization
data_standardized_zscore = stats.zscore(data)  # already sorted

df = pd.DataFrame({'data': data[:,0], 'data_standardized': data_standardized[:,0]})

%matplotlib inline
plt.close("all")
ax = sns.lineplot(x='data_standardized', y='data', data=df)
plt.show()<jupyter_output><empty_output><jupyter_text>norm prices<jupyter_code>import pandas as pd
import numpy as np
d = {"SPY" : [86.80, 86.70, 87.28, 84.67, 85.01],
    "AAPL": [90.36, 94.18, 92.62, 90.62, 92.30],
    "HNZ" : [33.95, 33.82, 33.38, 32.59, 31.99],
    "XOM" : [74.48, 74.47, 73.26, 71.39, 85.13],
    "GLD" : [86.23, 0, 85.13, 82.75, 84.46]}

df = pd.DataFrame(d)

# .loc for label based indexing or
# .iloc for positional indexing

normed = df/df.iloc[0]
normed['AAPL'] = np.nan
normed = normed.fillna(value=0)
print(normed[0:2])<jupyter_output>SPY  AAPL       HNZ       XOM  GLD
0  1.000000   0.0  1.000000  1.000000  1.0
1  0.998848   0.0  0.996171  0.999866  0.0
{'fraction_non_alphanumeric': 0.15482546201232034, 'fraction_numerical': 0.08788501026694046, 'mean_word_length': 4.1284210526315785, 'pattern_counts': {'":': 1, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '123239', 'license': 'MIT', 'n_tokens_mistral': 1114, 'n_tokens_neox': 960, 'n_words': 268, 'path': 'code/.ipynb_checkpoints/5_statistics-checkpoint.ipynb', 'repo_name': 'vicb1/miscellaneous', 'size': '2435'}