I am new to Python and pandas, and I have the codes like the one that's below:
for line in TWITTER_USER_IDs:
screen_name = line
start = api.GetUser(screen_name)
friends_object = api.GetFriendIDs(start)
followers_object = api.GetFolloerIDs(start)
friends = json.loads(friends_object)
followers = json.loads(followers_object)
startj = json.laods(start)
friends_df = pd.DataFrame(friends)
followers_df = pd.DataFrame(followers)
start_df = pd.DataFrame(startj)
I want to do something like:
EDGE_LIST1 = {'User':start_df,
'Follower': friends_df }
EDGE_LIST2 = {'User': followers_df,
'Follower': start_df }
but the number of rows of start_df
and the number of rows of friends_df
or followers_df
are different - so I don't think I can do that.
The solution would be to repeat the entry (note: There is only one entry in start_df
, as start_df
only stores Twitter username of one user) in start_df
number of times that is equal to friends_df
or followers_df
.
Can someone tell me how to do it?
I searched and searched internet but didn't get any results...
thanks