<jupyter_start><jupyter_text>Frequency table in Numpy<jupyter_code>ft_np = np.unique(affairs['marriage'], return_counts=True)

unique_elem_np = ft_np[0]
counts_np = ft_np[1]
print(f'unique_elem_np: \n{unique_elem_np}\n')
print(f'counts_np: \n{counts_np}\n')<jupyter_output>unique_elem_np: 
['average' 'happy' 'unhappy' 'very happy' 'very unhappy']

counts_np: 
[ 93 194  66 232  16]<jupyter_text>Frequency table in Pandas<jupyter_code>ft_pd = affairs['marriage'].value_counts()
print(f'ft_pd: \n{ft_pd}\n')<jupyter_output>ft_pd: 
very happy      232
happy           194
average          93
unhappy          66
very unhappy     16
Name: marriage, dtype: int64<jupyter_text>Frequency table with groupby<jupyter_code>affairs['marriage'].groupby(affairs['haskids']).value_counts().sort_index()<jupyter_output><empty_output><jupyter_text>Contingency table in pandas<jupyter_code>pd.crosstab(affairs['marriage'], affairs['haskids'])
pd.crosstab(affairs['marriage'], affairs['haskids'], margins=3)
pd.crosstab(affairs['marriage'], affairs['haskids'], normalize='all')
pd.crosstab(affairs['marriage'], affairs['haskids'], normalize='index')
pd.crosstab(affairs['marriage'], affairs['haskids'], normalize='columns')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1553398058252427, 'fraction_numerical': 0.023462783171521034, 'mean_word_length': 8.300751879699249, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '373374', 'license': 'MIT', 'n_tokens_mistral': 506, 'n_tokens_neox': 468, 'n_words': 68, 'path': 'ch1/1.5.1_descriptive_statistics.ipynb', 'repo_name': 'bmathias12/econometrics-using-python', 'size': '1236'}