0

我正在尝试从 Yahoo Finance 下载基本数据,例如 PE 比率、PB 比率、EV/EBITDA 等。这是我迄今为止所做的:

#import required libraries
import pandas as pd
import numpy as np
import requests
import xlsxwriter
from scipy import stats
import math
import secrets
import yfinance as yf
import matplotlib.pyplot as plt
import datetime as dt
import statsmodels.api as sm

pip install requests_html
stocks = pd.read_csv('constituents.csv')
from yahoo_fin.stock_info import get_data
sm.get_stats_valuation("aapl")

我收到此错误:

AttributeError                            Traceback (most recent call last)
<ipython-input-17-7a641ee9069d> in <module>
----> 1 sm.get_stats_valuation("aapl")

AttributeError: module 'statsmodels.api' has no attribute 'get_stats_valuation'

我该怎么办?

4

1 回答 1

1

我检查了您在评论中指定的网站。我认为您可以从 yahoo_fin 包的 stock_info 模块本身获得统计估值。请检查:

import yahoo_fin.stock_info as si
si.get_stats_valuation("aapl")
于 2021-09-05T06:39:19.703 回答