私はStatsmodel
を2日以内に「使用」しており、インポートコマンドなどに慣れていません。variance_inflation_factor
をhereから実行したいのですが、問題があります。私のコードは次の通りです:パンダ> Statsmodel:variance_inflation_factorを実装する構文エラー
from numpy import *
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
import statsmodels.formula.api as sm
from sklearn.linear_model import LinearRegression
import scipy, scipy.stats
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot')
from statsmodels.api import add_constant
from numpy import linalg as LA
import statsmodels as sm
## I have been adding libraries and modules/packages with the intention of erring on the side of caution
a = df1.years_exp
b = df1.leg_totalbills
c = df1.log_diff_rgdp
d = df1.unemployment
e = df1.expendituresfor
f = df1.direct_expenditures
g = df1.indirect_expenditures
sm.variance_inflation_factor((['a', 'b', 'c', 'd', 'e', 'f']), g)
then I get the following error:
AttributeError Traceback (most recent call last)
<ipython-input-61-bb126535eadd> in <module>()
----> 1 sm.variance_inflation_factor((['a', 'b', 'c', 'd', 'e', 'f']), g)
AttributeError: module 'statsmodels' has no attribute 'variance_inflation_factor'
このモジュールの読み込みと実行の正しい構文を教えてもらえますか?いくつかのソースコードへのリンクを投稿する方が便利な場合は、お尋ねください。しかし、私はこれが単なる構文上の問題であると感じています。 in the docs見られるように
コメントありがとうございました場合にのみ動作します。ここではこれを行うためのプログラム的な方法です!私はあなたのインポートコードを適用しましたが、 'outliers_influence.variance_inflation_factor((['a'、 'b'、 'c'、 'd'、 'e'、f '])、g)'を実装するいくつかの問題があります。 'AttributeError: 'list'オブジェクトには属性 'shape'がありません。私は質問を更新し、コードを操作して動作させることができるかどうかを確認します。 –
質問を更新しないでください - それは別の問題です。あなたは別の質問がある場合は、あなたの力の中でそれを試して解決するためにすべてを行い、それでもあなたがそれを理解できない場合は、スタックオーバーフローを求めて新しい質問をすることができます。 – miradulo