Last active
December 9, 2017 14:27
-
-
Save iprocheta/4cfd4cc9d078925a3e84720201f27b48 to your computer and use it in GitHub Desktop.
column comparisn
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['Cholesterol medicine years'].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['Cholesterol']=='Yes') & ((data['Cholesterol medicine years'=='NA']) |(data['Cholesterol medicine years'=='No']|(data['Cholesterol medicine years'=='VALID'])) | |
| data.loc[mask,'Cholesterol medicine years']=pd.to_numeric(data['Cholesterol medicine years'],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