熊猫中的Concat 2列-AttributeError:“ DataFrame”对象没有属性“ concat”

时间:2019-12-02 03:55:48

标签: python python-3.x pandas concatenation concat

我试图沿着熊猫的2列并列。代码:

import pandas as pd
import numpy as np
from statsmodels import api as sm
import pandas_datareader.data as web
import datetime

start = datetime.datetime(2015,2,12)
end = datetime.datetime.today()
df = web.get_data_yahoo(['F', '^GSPC'], start, end)

df1 = df.concat(columns=[F['Close'], gspc['Close']], axis=1)

但是我遇到以下错误:

AttributeError: 'DataFrame' object has no attribute 'concat'

1 个答案:

答案 0 :(得分:1)

它是pd.concat(),而不是df.concat()