Create empty Dataframe with same dimensions as another?

Creating an empty dataframe with the same index and columns as another dataframe:

import pandas as pd
df_copy = pd.DataFrame().reindex_like(df_original)

For anyone coming to this page looking to create a dataframe of same columns, same dtypes, and no rows:

import pandas as pd
df_copy = df_original.iloc[:0,:].copy()

import pandas as pd 
df_copy = pd.DataFrame(index=df_original.index,columns=df_original.columns)

@GaspareBonventre's answer can be slow, because of an issue with the Pandas DataFrame constructor. I find it much faster to do

import numpy as np
df_copy = pd.DataFrame(np.zeros(df_original.shape))
df_copy.index = df_original.index
df_copy.columns = df_original.columns

Tags:

Python

Pandas