# Load library
import numpy as np
import pandas as pd

"""
Explanation: Title: Deleting Missing Values  
Slug: deleting_missing_values  
Summary: How to delete missing values.   
Date: 2017-09-02 12:00
Category: Machine Learning
Tags: Preprocessing Structured Data
Authors: Chris Albon 
Preliminaries
End of explanation
"""


# Create feature matrix
X = np.array([[1, 2], 
              [6, 3], 
              [8, 4], 
              [9, 5], 
              [np.nan, 4]])

"""
Explanation: Create Data Frame
End of explanation
"""


# Remove observations with missing values
X[~np.isnan(X).any(axis=1)]

"""
Explanation: Drop Missing Values Using NumPy
End of explanation
"""


# Load data as a data frame
df = pd.DataFrame(X, columns=['feature_1', 'feature_2'])

# Remove observations with missing values
df.dropna()

"""
Explanation: Drop Missing Values Using pandas
End of explanation
"""


