我从quandl和fred中获取了一些数据,然后尝试将它们放入相同的CSV文件中。但是我的$project
数据在csv文件中丢失。
这是我的代码:
df <- data.frame(column_1 = c("A", "B", "C"), column_2 = c("w,x", "z", "q,r,s"))
l_vals <- strsplit(as.character(df$column_2), split = ",", perl =TRUE)
l_append = list()
for(i in seq_along(l_vals)){
l_append <- c(l_append,paste0(df$column_1[i], l_vals[[i]]))
}
unlist(l_append)
答案 0 :(得分:0)
fredapi.get_series的规范定义了必需的参数(当指定了observation_start时):
Parameters
----------
series_id : str
Fred series id such as 'CPIAUCSL'
observation_start : datetime or datetime-like str such as '7/1/2014', optional
earliest observation date
observation_end : datetime or datetime-like str such as '7/1/2014', optional
latest observation date
kwargs : additional parameters
Any additional parameters supported by FRED. You can see https://api.stlouisfed.org/docs/fred/series_observations.html for the full list
在我看来,您的日期格式不正确-尝试使用
spot_price = fred.get_series('DCOILBRENTEU',observation_start='1/1/2017')
相反。