Created
December 8, 2017 07:47
-
-
Save iprocheta/f73ec101cab97e34d9da20877f713d10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data = pd.read_csv('E:\\training.csv') | |
| array3 = data['Column2'].replace(np.NaN,-1) | |
| length = array3.shape[0] | |
| print(length) | |
| arr3 = []; | |
| for i in range(length): | |
| if array3[i] != -1: | |
| # print(i) | |
| arr3.append(array[i]) | |
| print(arr3) | |
| trimmed = st.trim_mean(arr3,.05) | |
| mask=(data['Column1']=='Yes') & ((data['Column2'=='NA']) |(data['Column2'=='No']) | |
| data.loc[mask,'Column2']=pd.to_numeric(data['Column2'],errors='coerce').fillna(trimmed) | |
| data.to_csv(r'E:\\data.csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment