I received a DataFrame from somewhere and want to create another DataFrame with the same number and names of columns and rows (indexes). For example, suppose that the origin
This has worked for me in pandas 0.22: df2 = pd.DataFrame(index=df.index.delete(slice(None)), columns=df.columns)
df2 = pd.DataFrame(index=df.index.delete(slice(None)), columns=df.columns)
Convert types: df2 = df2.astype(df.dtypes)
df2 = df2.astype(df.dtypes)
delete(slice(None)) In case you do not want to keep the values of the indexes.
delete(slice(None))