3

Given the following list:

list=['a','b','c']

I'd like to create a data frame where the list is the column of values. I'd like the header to be "header".

Like this:

header
a
b
c

Thanks in advance!

1
  • Do note that list is a built-in type so you should most likely name your variable to something else :) Commented Dec 11, 2020 at 15:00

1 Answer 1

12

Wouldn't that be:

list=['a','b','c']
df= pd.DataFrame({'header': list})


  header
0      a
1      b
2      c
Sign up to request clarification or add additional context in comments.

1 Comment

Yes; I spaced out on that one for sure.

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.