create blank dataframe pandas code example

Example 1: pandas create empty dataframe

# Basic syntax:
import pandas as pd
empty_dataframe = pd.DataFrame()

# Create empty dataframe with column names
empty_dataframe = pd.DataFrame(columns=['your', 'column', 'names'])

# Create empty dataframe with row names
empty_dataframe = pd.DataFrame(index=['your', 'row', 'names'])

Example 2: create empty pandas dataframe

df = pd.DataFrame(columns=['a', 'b', 'c'])

Example 3: create an empty dataframe

import pandas as pd
df = pd.DataFrame(columns=['A','B','C','D','E','F','G'])