<jupyter_start><jupyter_text>Handling Missing Values<jupyter_code>import pandas as pd
import numpy as np
df = pd.read_csv('NFL Play by Play 2009-2017 (v4).csv')
np.random.seed(0)
df.head()
df.describe()
df.isnull()
mv = df.isnull().sum()
mv[0:15]
total_cells = np.product(df.shape)
total_missing = mv.sum()

# percent of data that is missing
percent_missing = (total_missing/total_cells) * 100
print(percent_missing)
df.dropna()
dropnavalue= df.dropna(axis=1)
dropnavalue.head()
print("Columns in original dataset: %d \n" % df.shape[1])
print("Columns with na's dropped: %d" % dropnavalue.shape[1])
autofindingnavalue = df.loc[:, 'EPA':'Season'].head()
autofindingnavalue
autofindingnavalue.fillna(0)
autofindingnavalue.fillna(method='bfill', axis=0).fillna(0)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15316455696202533, 'fraction_numerical': 0.027848101265822784, 'mean_word_length': 7.071428571428571, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '109358', 'license': 'MIT', 'n_tokens_mistral': 318, 'n_tokens_neox': 304, 'n_words': 62, 'path': 'Data Cleaning/Handling Missing Values.ipynb', 'repo_name': 'ashamandale/Technolab-Task-Intern', 'size': '790'}