import numpy as np
import pandas as pd
import statsmodels.api as sm
import statsmodels.graphics as smg
data = pd.DataFrame({'Y': np.random.rand(1000), 'X':np.random.rand(1000)})
这有效
smg.regressionplots.plot_fit(sm.OLS(data.Y.values, data.X.values).fit(), 0, y_true=None)
这不
smg.regressionplots.plot_fit(sm.OLS(data.Y, data.X).fit(), 0, y_true=None)
smg.regressionplots.plot_fit(sm.OLS(data['Y'], data['X']).fit(), 0, y_true=None)