0 votes
in Python Pandas by
How will you create an empty DataFrame in pandas?

1 Answer

0 votes
by

To create a completely empty Pandas dataframe, we use do the following:

import pandas as pd

MyEmptydf = pd.DataFrame()

This will create an empty dataframe with no columns or rows.

To create an empty dataframe with three empty column (columns X, Y and Z), we do:

df = pd.DataFrame(columns=[‘X’, ‘Y’, ‘Z’])

Related questions

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