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 : light-louse-8t3wjpi61bop
df.empty == True
Source : | Last Update : Mon, 09 Mar 20
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 : adrien-wehrl
if df.empty: print('Your df is empty...')
Source : | Last Update : Wed, 08 Apr 20
Answered by : supadude
df_empty = pd.DataFrame({'A' : []})
df_empty.empty # True
Source : https://pandas.pydata.org/pandas-docs/version/0.18.1/generated/pandas.DataFrame.empty.html | Last Update : Tue, 11 Aug 20
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