<jupyter_start><jupyter_text>Import Pandas<jupyter_code>import pandas as pd<jupyter_output><empty_output><jupyter_text>Read in the dataset<jupyter_code>data = pd.read_table('data-zillow.csv', sep=',')
data.head()<jupyter_output><empty_output><jupyter_text>Filter columns by name using filter()<jupyter_code>filtered_data = data.filter(items=['State', 'Metro'])
filtered_data.head()<jupyter_output><empty_output><jupyter_text>Filter columns by regular expression using filter()<jupyter_code>filtered_data = data.filter(regex='Region', axis=1)
filtered_data.head()<jupyter_output><empty_output><jupyter_text>Filter data using boolean indexing<jupyter_code>price_filter_series = data['Zhvi'] > 500000
price_filter_series.head()
data[price_filter_series].head()<jupyter_output><empty_output><jupyter_text>An alternative way to filter<jupyter_code>data[data.Zhvi >= 1000000].head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13134657836644592, 'fraction_numerical': 0.01545253863134658, 'mean_word_length': 14.372881355932204, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '593480', 'license': 'MIT', 'n_tokens_mistral': 344, 'n_tokens_neox': 325, 'n_words': 41, 'path': 'Chapter02/Filter rows of a pandas DataFrame by column value.ipynb', 'repo_name': 'dragonyy/Mastering-Exploratory-Analysis-with-pandas', 'size': '906'}