Answered by : charlesalexandre-roy
# 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'])
Source : | Last Update : Wed, 19 May 21
Answered by : hilarious-hornet-bubhrtg3f9sy
newDF = pd.DataFrame() #creates a new dataframe that's empty
newDF = newDF.append(oldDF, ignore_index = True) # ignoring index is optional
# try printing some data from newDF
print newDF.head() #again optional
Source : https://stackoverflow.com/questions/13784192/creating-an-empty-pandas-dataframe-then-filling-it | Last Update : Mon, 04 May 20
Answered by : alberto-blanco-garcs
df = pd.DataFrame(columns=['a', 'b', 'c'])
Source : | Last Update : Mon, 28 Sep 20
Answered by : strange-salamander-ymih0hyhvd2l
import pandas as pd
df = pd.DataFrame(columns=['A','B','C','D','E','F','G'])
Source : | Last Update : Wed, 22 Apr 20
Answered by : afshin-amiri
import pandas as pd
col_names = ['A', 'B', 'C']
my_df = pd.DataFrame(columns = col_names)
my_df
Source : https://stackoverflow.com/questions/13784192/creating-an-empty-pandas-dataframe-then-filling-it/49973940#49973940 | Last Update : Mon, 15 Aug 22
Answered by : george-tirelo-shikwambana
#This was first Posted By Hilarious Hornet
newDF = pd.DataFrame() #creates a new dataframe that's empty
newDF = newDF.append(oldDF, ignore_index = True) # ignoring index is optional
# try printing some data from newDF
print(newDF.head()) #again optional
Source : https://stackoverflow.com/questions/13784192/creating-an-empty-pandas-dataframe-then-filling-it | Last Update : Sun, 24 Oct 21
Answered by : charming-cobra-v45bdty1gngb
>>> df_empty = pd.DataFrame({'A' : []})
>>> df_empty
Empty DataFrame
Columns: [A]
Index: []
>>> df_empty.empty
True
Source : https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.empty.html | Last Update : Mon, 06 Jul 20