DataFrame In Pandas
Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). A Data frame is a two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows and columns.
Pandas DataFrame consists of three principal components, the data, rows, and columns.
Creating a Pandas DataFrame
In the real world, a Pandas DataFrame will be created by loading the datasets from existing storage, storage can be SQL Database, CSV file, an Excel file. Pandas DataFrame can be created from the lists, dictionary, and from a list of the dictionary, etc. Dataframe can be created in different ways here are some ways by which we create a data frame:
Creating a data frame using List: DataFrame can be created using a single list or a list of lists.
# import pandas as pd
import
pandas as pd
# list of strings
lst =
['Geeks', 'For', 'Geeks', 'is',
'portal', 'for', 'Geeks']
# Calling DataFrame constructor on list
df =
pd.DataFrame(lst)
print(df)