Multi-dataframe For Loop Analysis Python -
i have data looks following:
data#1 class1: name1 name2 name3 name4 class2: name5 name6 name7 class3: name8 name9 name10 name11 name12 name13 … class500: namex namey
where above has 500 classes school given names corresponding class
next, have data set has of names (some not included in classes) looks following (pairwise correlation coefficients):
data#2 name1 name2 name3 …………………………………….. name4000 name1: 1 .96 .5 name2: 0.5 1 -.6 name3: 0.40 -.45 1 ………………………………………………………………………………………………. name4000: -.24 .08 .9 ……………………………………….. 1
my goal take data dataframe1 , analyze each classes genes data 2. meaning; might this:
class1df:
name1 name2 name3 name4 name1 1 .5 .96 .5 name2 0.5 1 -.6 .8 name3 0.4 -.45 1 0.03 name4 .7 .76 .4 1
and build dataframe every single class.
after getting of these new data frames, wish calculate mean , other statistical calculations each new dataframe generate.
class1 class2 class3 ... etc... etc... max min mean
i have written can insert, “class 50”, , i’ll want. however, don't want have 500 classes. therefore question is,
how do “smart” way? i’m trying write loops same thing on , on again...but don’t know begin writing/or how write them :(
i suppose should noted calculations @ end want able see (perhaps big data frame table?)
any or guidance appreciated! sample of have written below showcase have done before:
‘’’ finding class want @ (the problem want answer, how do of classes) ‘’’ <load data#1> classname = “class1” classnamecall = data#1.loc[classname] classnamecall = classnamecall.dropna() classnamecall = classnamecall.upper() ‘’’ next data table ‘’’ <load data#2> myclass = data#2.loc[classnamecall,classnamecall] myclass = myclass.dropna(axis=0, how=’all’) myclass = myclass.dropna(axis=1,how=’all’) ntot = myclass.groupby(myclass.index).size() tot = ntot.sum() ‘’’ data analysis ‘’’ calculate min/max/mean myclass…
i can find , analyze specific class if choose, again, want able every class. what’s best way go this?
i sorry wall of text, , thank each of in advance reading , helping! let me know if you'd me provide more information, or if question unclear! again!
Comments
Post a Comment