简体   繁体   中英

Send data from all collections to Dataframe (MongoDB, Python)

I have tried to use this code:

preDF = pd.DataFrame
for ticker in tickers:
    df_forpre = read_ticker(ticker, '2017-01-22')
    df_forpre['ticker'] = ticker
    preDF = pd.concat([preDF,df_forpre], axis=0)

But I receive:

cannot concatenate a non-NDFrame object

How I can get data from all collection and send it to dataframe with name collection

The mistake was in concat, it should be:

preDF = pd.concat([df_forpre], axis=0)

Instead of:

preDF = pd.concat([preDF,df_forpre], axis=0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM