Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Data Science by (17.6k points)

So I have initialized an empty pandas DataFrame and I would like to iteratively append lists (or Series) as rows in this DataFrame. What is the best way of doing this?

1 Answer

0 votes
by (41.4k points)

Just, create the DataFrame:.

 import pandas as pd

 simple_list=[['a','b']]

 simple_list.append(['e','f'])

 df=pd.DataFrame(simple_list,columns=['col1','col2'])

    col1  col2

0    a      b

1    e      f

If you want to learn more about Pandas then visit this Python Course designed by the industrial experts.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...