need to make completely new dataframe of peak values with:
In [1]:
drive_path = 'c:/'
import numpy as np
import pandas as pd
import os
import sys
import matplotlib.pyplot as plt
from scipy.stats import ks_2samp
from scipy.stats import anderson_ksamp
from scipy.stats import kruskal
from scipy.stats import variation
%matplotlib
import seaborn as sns
from scipy.stats import zscore
from scipy.stats import nanmean
from scipy.stats import nanstd
In [47]:
filename='C:\Users\Annie\Documents\Data\Ca_Imaging\GoodFiles\\fullpeak.csv'
comp=pd.read_csv(filename)
comp_sorted=comp.reindex_axis(comp.mean().sort_values().index, axis=1)
comp_labels=pd.DataFrame(comp.Mouse)
comp_group=pd.DataFrame(comp.Group)
tmp=[comp_group,comp_labels,comp_sorted]
composite_full=pd.concat(tmp,axis=1)
cfull=pd.melt(composite_full,['Group','Mouse'],var_name="Odor")
In [10]:
test=pd.read_csv('C:\Users\Annie\Documents\Data\Ca_Imaging\GoodFiles\\160325_1\\9dt.txt')
In [11]:
trials=pd.read_csv('C:\\Users\\Annie\\Documents\\Data\\Ca_Imaging\\Analysis\\Odor_Panel\\Odor_Trials.csv')
In [46]:
composite_full.head()
Out[46]:
In [39]:
In [98]:
In [35]:
#Order all the trials
df=pd.DataFrame([])
for a in trials.File.unique():
temp=trials[trials.File==a]
tone=temp[['Odor','T1']]
tone.columns=['Odor','Trial']
ttwo=temp[['Odor','T2']]
ttwo.columns=['Odor','Trial']
tthree=temp[['Odor','T3']]
tthree.columns=['Odor','Trial']
tfour=temp[['Odor','T4']]
tfour.columns=['Odor','Trial']
trialsdf=pd.concat([tone,ttwo,tthree,tfour],axis=0,ignore_index=True)
sortedtrials=trialsdf.sort_values('Trial')
sortedtrials=sortedtrials[sortedtrials.Trial!=0]
sortedtrials=sortedtrials.reset_index(drop=True)
sortedtrials['Mouse']=a
df=df.append(sortedtrials,ignore_index=True)
#Get Odor1 and Odor2
# TH=pd.DataFrame([])
# full=pd.DataFrame([])
# for x in df.Mouse.unique():
# if <len(sortedtrials.Trial.unique()):
# Odor1=sortedtrials[sortedtrials.Trial==x]['Odor'].values
# Odor2=sortedtrials[sortedtrials.Trial==x+1]['Odor'].values
# tmp=({'Mouse':a,'Odor1':Odor1,'Odor2':Odor2,'Trial1':x,'Trial2':x+1})
# TH=TH.append(tmp,ignore_index=True)
In [42]:
df[df.Mouse==x]
Out[42]:
In [44]:
for x in df.Mouse.unique():
for y in df[df.Mouse==x]['Trial'].unique():
if y<len(df[df.Mouse==x]['Trial']):
Odor1=df[df.Mouse==x]
In [168]:
#WHY IS X NOT CHANGING BACK TO INT& WHY CAN I NOT GET ODOR 1 valuess
Out[168]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: