本文介绍了 pandas 导入FRED数据(pandas.io.data或pandas_datareader)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有一个非常简单的问题,我找不到阅读文档的答案(以下是摘录):

Very simple question here which i could not find the answer for reading the docs (below is an excerpt):

import pandas_datareader.data as web    # pandas 0.19.x and later
import datetime
start = datetime.datetime(2010, 1, 1)
end = datetime.datetime(2013, 1, 27)
gdp = web.DataReader("GDP", "fred", start, end)

请注意,如果您使用的是较早版本的熊猫,则应改用正在导入:

Note that if you have an older version of pandas you should instead do thefollowing import:

import pandas.io.data as web    # pandas 0.18.x and earlier

所以我的问题是...在哪里可以找到可接受参数的列表(例如GDP),它们对应什么?甚至GDP都有许多不同的风格-FRED列出了BEA帐户代码以进行澄清,因此我不确定如何对帐.

So my question is ... where can one find a list of the acceptable parameters (like GDP), and what they correspond to? Even GDP has many different flavors - and FRED lists BEA Account Code's to clarify so I'm not sure how these are reconciled.

推荐答案

像@Solaxun我除了找到FRED之外,找不到找到相关代码的好方法.例如,我单击此处获得GDP的百分比变化:

Like @Solaxun I couldn't find a good way to search for the relevant codes other than going to FRED. For example, I clicked around to get the percentage change in GDP here:

https://fred.stlouisfed.org/series/A191RL1Q225SBEA

您可以在URL A191RL1Q225SBEA的末尾获取该代码,并将其插入以得到如下系列:

And you can take that code at the end of the URL A191RL1Q225SBEA and plug it in to get the series like this:

gdp_pct_change = web.DataReader("A191RL1Q225SBEA", "fred", start, end)

为方便起见,还有其他一些代码,它们可以使您了解可以在那里获得的数据的广度.请注意,对于GDP之类的许多系列,都有很多变体(季节性与非季节性调整,真实与名义等),因此通常没有直接替代FRED并阅读确切说明的替代方法.

Here are some other codes for convenience and to give you a sense the breadth of data you can get there. Note that for many series like GDP there are many variants (seasonally vs not seasonally adjusted, real vs nominal, etc.) so there often is no substitute for just going directly to FRED and reading the exact descriptions.

  • 实际国内生产总值(A191RL1Q225SBEA)-百分比变化
  • 实际国内生产总值(GDPC1)-美元
  • 联邦债务:公共债务总额占国内生产总值的百分比(GFDEGDQ188S)
  • 所有城市消费者的消费者价格指数:所有项目(CPIAUCSL)

与就业相关的统计信息:

Employment related stats:

  • 平民失业率(UNRATE)
  • 所有员工:非农工资总额(PAYEMS)
  • 初始索赔的4周移动平均值(IC4WSA)

利率:

  • 10年期国库债券固定利率(DGS10)
  • 有效联邦基金利率(FEDFUNDS)
  • 3个月伦敦银行同业拆放利率(LIBOR),基于美元(USD3MTD156N)

股票指数:

  • 标准普尔500(SP500)
  • 日经平均股票指数,日经225(NIKKEI225)

这篇关于 pandas 导入FRED数据(pandas.io.data或pandas_datareader)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 14:52