0 votes
in Python Pandas by
What is a DataFrame in pandas?

1 Answer

0 votes
by

Pandas DataFrame is 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-

n the real world, a Pandas DataFrame will be created by loading the datasets from existing storage, storage can be SQL Database, CSV file, and Excel file. Pandas DataFrame can be created from the lists, dictionary, and from a list of dictionary etc. Dataframe can be created in different ways here are some ways by which we create a dataframe:

Creating a dataframe 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)

Related questions

0 votes
asked Nov 9, 2021 in Python Pandas by Robin
0 votes
asked Aug 14, 2021 in Python Pandas by SakshiSharma
...