Питон дисперсионного анализа
Привет всем,
У меня есть файл excel С 400 субъектами для исследования, и для каждого из них у меня есть их возраст, их пол и еще 40 столбцов биологических переменных.
Что я уже пробовал:
import os import numpy as np import pandas as pd from pandas import ExcelFile from pandas import ExcelWriter import matplotlib.pyplot as plt import seaborn as sns from functools import reduce import statsmodels.api as sm from statsmodels.formula.api import ols from scipy import stats %matplotlib inline >Analisi = 'C:/users..... AnalisiISAD =pd.read_excel (r'C:\Users..... >meanMET = Analisi.mean() meanMET[1:41:2] ---->these are the column I want to do first, as a first try MeanMETList = [...] ----> here I made the list of columns a list of only the float values from that columns (which had also a line of text) > grps = pd.unique(Analisi.MeanMETList.values) d_data = {grp:Analisi['MeanMETList'][Analisi.MeanMETList == grp] for grp in grps} k = len(pd.unique(Analisi.MeanMETList)) N = len(Analisi.values) n = Analisi.groupby('AgeT1') --------> here there are no errors > SSbetween = (sum(Analisi.groupby('AgeT1').sum()['MeanMETList']**2)/n) - (Analisi['MeanMETList'].sum()**2) / N sum_y_squared = sum([value**2 for value in Analisi['MeanMETList'].values]) SSwithin = sum_y_squared - sum(Analisi.groupby('AgeT1').sum()['MeanMETList']**2) / n SStotal = sum_y_squared - (Analisi['MeanMETList'].sum()**2) / N Here goes the error TypeError: unsupported operand type(s) for /: 'float' and 'DataFrameGroupBy' "