In [1]:
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.stats import norm
from sklearn.preprocessing import StandardScaler
from scipy import stats
from mpl_toolkits.mplot3d import Axes3D
from sklearn.model_selection import train_test_split
import warnings
import math


warnings.filterwarnings('ignore')
%matplotlib inline


/Users/rashedkarim/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')

In [2]:
def threshold(df, t, which_feature, csv_filename):
    df['threshold'] = np.nan
    df['threshold'] = np.where(df[which_feature] > t, 1,0)
    
    header = ['X','Y','Z','threshold']
    df.to_csv(csv_filename, columns = header, index=False)
            
    return df

In [ ]: