
嗨,我正在運行一個程式,我被警告說 pandas 的 append 方法正在貶值。我將如何在以下代碼中使用連接。
tweets_df = tweets_df.append(pd.DataFrame({'user_name': tweet.user.name,
'user_location': tweet.user.location,
'user_description': tweet.user.description,
'user_verified': tweet.user.verified,
'date': str(tweet.created_at),
'text': text,
'hashtags': [hashtags if hashtags else None],
'source': tweet.source}))
uj5u.com熱心網友回復:
tweet = pd.Series({
'user_name': tweet.user.name,
'user_location': tweet.user.location,
'user_description': tweet.user.description,
'user_verified': tweet.user.verified,
'date': str(tweet.created_at),
'text': text,
'hashtags': [hashtags if hashtags else None],
'source': tweet.source})
df = pd.concat([tweets_df, tweet])
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/459187.html
