Created
April 10, 2018 05:07
-
-
Save ssstrike/3221426a40d50820f1d3bb354e7bea41 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
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Sat Apr 07 21:10:33 2018 | |
| @author: Fuzzy | |
| """ | |
| import pandas as pd | |
| #import numpy as np | |
| #creates dataframe and removes rows Unnamed 615-638 (they are empty) | |
| df = pd.read_csv('tfExp.csv') | |
| count = 615 | |
| while count <639: | |
| del df['Unnamed: ' + str(count)] | |
| count += 1 | |
| #creates the id2Index dict. | |
| id2Index = {} | |
| indexList = list(df.index.get_values()) | |
| idList = list(df['Unnamed: 0']) | |
| count = 0 | |
| while count < 767: | |
| id2Index[idList[count]] = indexList[count] | |
| count += 1 | |
| #manual inputs | |
| key = 347853 | |
| key2 = 9421 | |
| #Broken, creates list of headers | |
| #is_key = df['Unnamed: 0'] == key | |
| #mylist = list(df.loc[is_key]) | |
| #uses id2Index to isolate key's row into a list | |
| rowKey = list(df.loc[id2Index[key]]) | |
| rowKey.remove(rowKey[0])#removes the first element | |
| rowKey2 = list(df.loc[id2Index[key2]]) | |
| rowKey2.remove(rowKey2[0]) | |
| #for testing person r function | |
| from scipy import stats | |
| p = stats.pearsonr(rowKey,rowKey2) | |
| passes = False | |
| if abs(p[0]) > 0.8 and abs(p[1]) < 0.05: | |
| passes = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment