0

Let's say I have a dataframe that looks like this:

df2

         A
    0

I have a list that looks like this:

stuff = ['apples', 'oranges']

I want to add the records from my list into my data frame so that my output looks like this:

                          A
0     ['apples', 'oranges']

Any suggestions? I am not sure where to begin.

2 Answers 2

1

Use .at:

df.at[0, 'A'] = ['apples', 'oranges']
Sign up to request clarification or add additional context in comments.

1 Comment

For accessing "cells", use df.at
0

You can do the following

import pandas as pd
list = [['oranges', 'apples']]
df= pd.DataFrame()
df['A'] = list

1 Comment

df['A'] = list will define the 'A' column

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.