我有一个具有以下结构的数据框:
df.columns
Index(['first_post_date', 'followers_count', 'friends_count',
'last_post_date','min_retweet', 'retweet_count', 'screen_name',
'tweet_count', 'tweet_with_max_retweet', 'tweets', 'uid'],
dtype='object')
在推文系列中,每个单元格都是另一个数据框,其中包含用户的所有推文。
df.tweets[0].columns
Index(['created_at', 'id', 'retweet_count', 'text'], dtype='object')
我想将此数据帧转换为多索引帧,主要是通过破坏包含推文的单元格。一个索引是uid,另一个是tweet中的id。
我怎样才能做到这一点?