<jupyter_start><jupyter_text>Sample by percentage

- [API Reference](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.sample.html)<jupyter_code>sample_percentage= 0.2 # 20 percent

df.sample(frac = sample_percentage)<jupyter_output><empty_output><jupyter_text>Sample by number of items 
**Note**: sample by number of items cannot be used together with percentage<jupyter_code>sample_num = 5

df.sample(n = sample_num)<jupyter_output><empty_output><jupyter_text>Sample by specific values<jupyter_code>df.loc[df['date'] == '20110205']<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1226252158894646, 'fraction_numerical': 0.022452504317789293, 'mean_word_length': 8.206349206349206, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, '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': '665401', 'license': 'MIT', 'n_tokens_mistral': 219, 'n_tokens_neox': 204, 'n_words': 34, 'path': 'notebooks/pandas/sample_df.ipynb', 'repo_name': 'codenamewei/pydata-science-playground', 'size': '579'}