Pandas DataFrame is a 2-dimensional labeled data structure with columns of potentially different types. It is generally the most commonly used pandas object.
Pandas DataFrame can be created in multiple ways. Let’s discuss different ways to create a DataFrame one by one.
Creating Pandas DataFrame from lists of lists.
Import pandas library
import pandas as pd
# initialize list of lists
data = [[‘tom’, 10], [‘nick’, 15], [‘juli’, 14]]
# Create the pandas DataFrame
df = pd.DataFrame(data, columns = [‘Name’, ‘Age’])
# print dataframe.
df