1

I have the two data frames my first data frame, start_df_1, looks like this:

start_df_1

              0
0   3Degrees_Inc 
1   3Degrees_Inc
2   3Degrees_Inc
3   3Degrees_Inc
4   3Degrees_Inc
5   3Degrees_Inc
6   3Degrees_Inc
7   3Degrees_Inc
8   3Degrees_Inc
9   3Degrees_Inc
10  3Degrees_Inc

my second data frame friends_df looks like this:

friends_df
            0
0      MEGreenPower
1       LympheDIVAs
2     Ecopreneurist
3     issielapowsky
4     NatureClimate
5      miketuritzin
6         greenbang
7     GoodCleanTech
8            EDFbiz
9         adavies47
10        petedanko

I am trying to make a new data frame, something like:

  concatenated_df          

               User        Follower
0      MEGreenPower    3Degrees_Inc
1       LympheDIVAs    3Degrees_Inc
2     Ecopreneurist    3Degrees_Inc
3     issielapowsky    3Degrees_Inc
4     NatureClimate    3Degrees_Inc
5      miketuritzin    3Degrees_Inc
6         greenbang    3Degrees_Inc
7     GoodCleanTech    3Degrees_Inc
8            EDFbiz    3Degrees_Inc
9         adavies47    3Degrees_Inc
10        petedanko1   3Degrees_Inc

note that the new column is added, and first column and the second column is named as "User" and "Follower", respectively. I tried:

EDGE_LIST1 = pandas.DataFrame.from_dict({'User':friends_df, 
                                         'Follower': start_df_1}, orient='columns')

however it is throwing me an error:

ValueError: If using all scalar values, you must must pass an index

could you please help me out? thank you.

1 Answer 1

1

I found a solution; you just do:

EDGE_LIST1 = pandas.concat({'User':start_df_1, 'Follower': friends_df}, axis=1)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.