Python DataFrame转换为元组而不是DataFrame

Python DataFrame转换为元组而不是DataFrame,python,pandas,dataframe,Python,Pandas,Dataframe,我首先使用BeautifulSoup: mydivs = soup.findAll('div', {"class": "content"}) 因此,mydivs中的每个mydiv如下所示: <div class="content">A number of hats by me <br/><br/>three now though ... </div> 这是我试过的代码 A=[] indices=[] j=0 for div in mydivs

我首先使用BeautifulSoup:

mydivs = soup.findAll('div', {"class": "content"})
因此,
mydivs
中的每个
mydiv
如下所示:

<div class="content">A number of hats by me <br/><br/>three now though ... </div>
这是我试过的代码

A=[]
indices=[]
j=0

for div in mydivs:
    A.append(div)
    indices.append(j)
    j+=1

DF = pd.DataFrame({'index': indices, "posts": A})
当我打印出
形状时
我得到

print DF.shape()
TypeError: 'tuple' object is not callable

但是,我希望
DF
是一个数据帧,而不是
元组。如何修复此问题?

形状是
DF
的一个属性。该属性是一个
元组。您正试图使用引发错误的
()
调用它。如果您想要形状,只需执行
DF.shape

print DF.shape
print DF.shape()
不是

print DF.shape()