小编Kev*_*743的帖子

从python中的factor_analysisr计算拟合优度和rmsea

我正在使用Factor_analyzer模块在 python 中执行验证性因子分析。

我搜索了各种方法来生成模型诊断,例如近似均方根误差、卡方、CFI 和 Tucker-Lewis 指数。我对数学不是特别感兴趣,对Python也比较陌生,但我已经能够应付大部分内容了。

据我了解,factor_analyzer 模块会生成许多不同的对象,理论上,这些对象允许我进行额外的计算,并且我找到了这份文档,它为我提供了我需要的大部分公式。但是,我不知道如何采取(或计算)来获得我需要的模型诊断。

CFA代码是


model_dict = {"F1": factor_1,
              "F2": factor_2}# I have made these lists previously

model_spec = ModelSpecificationParser.parse_model_specification_from_dict(df[influence_scale],
                                                                           model_dict)
cfa = ConfirmatoryFactorAnalyzer(model_spec, disp=False)

cfa.fit(df[influence_scale].values)

cfa_loadings = pd.DataFrame(cfa.loadings_)
Run Code Online (Sandbox Code Playgroud)

我没有收到任何错误,并且代码运行良好,为我提供了干净的负载,正如我在每个因素上所期望的那样,但是我真的坚持获取我需要的额外统计数据。

如果有人能帮助我,我将非常感激。

python factor-analysis goodness-of-fit

5
推荐指数
1
解决办法
1247
查看次数

从 xlsx 导入到 Pandas 时带有“无”标题的列

Importing a heavily formatted excel worksheet into pandas results in some columns which are entirely blank and have 'None' when viewing df.columns. I need to remove these columns but I'm getting some strange output that makes it hard for me to figure out how exactly to drop them.

****Editing for clarity****

The excel worksheet is heavily formatted and must be reshaped for the data to be used in analysis. In essence, col A is a list of questions and …

python pandas xlwings

5
推荐指数
1
解决办法
131
查看次数

读取带有列表的熊猫列以创建新的分类列

我有一列看起来像这样的字符串

col_1
Spiderman
Abe Lincoln
Superman
Ghandi
Jane Austin
Robert de Niro
Elon Musk
George Bush
Bill Gates
Barak Obama
Anne Frank
Run Code Online (Sandbox Code Playgroud)

我手动浏览了该列,并列出了这些字符的类别列表:

l1 = [ 'Abe Lincoln', 'George Bush', 'Barak Obama']
l2 = ['Spiderman', 'Superman']
l3 = ['AnneFrank', 'Ghandi']
Run Code Online (Sandbox Code Playgroud)

我已经对这些列表做出了规定

dict = {'l1': l1, 'l2': l2,'l3': l3} #and so on
Run Code Online (Sandbox Code Playgroud)

我想做的是通过读取第1列创建一个新列,并根据str(cell)出现在哪个列表中返回一个数字;所以输出将是

 col_1            col2
Spiderman          2
Abe Lincoln        1
Superman           2
Ghandi             3
Jane Austin        4
Robert de Niro     4
Elon Musk          4
George Bush        1
Bill Gates         4
Barak …
Run Code Online (Sandbox Code Playgroud)

python list dataframe pandas

3
推荐指数
1
解决办法
45
查看次数