You can use the attribute df.empty
to check whether it’s empty or not:
if df.empty:
print('DataFrame is empty!')
Source: Pandas Documentation
More Related Contents:
- Why does the following code cant get value of n_fold = 1?
- How to change the order of DataFrame columns?
- Filter dataframe rows if value in column is in a set list of values [duplicate]
- Add missing dates to pandas dataframe
- Converting a Pandas GroupBy output from Series to DataFrame
- Pandas: sum DataFrame rows for given columns
- datetime dtypes in pandas read_csv
- Pandas DataFrame: replace all values in a column, based on condition
- Pandas – Slice large dataframe into chunks
- What is the fastest way to upload a big csv file in notebook to work with python pandas?
- Calculate average of every x rows in a table and create new table
- How to check if any value is NaN in a Pandas DataFrame
- Removing prefix from column names in Pandas
- Python Pandas replicate rows in dataframe
- Can’t drop NAN with dropna in pandas
- python dataframe pandas drop column using int
- how to read certain columns from Excel using Pandas – Python
- How to plot two columns of a pandas data frame using points
- which is faster for load: pickle or hdf5 in python
- How to read a list of parquet files from S3 as a pandas dataframe using pyarrow?
- Return multiple columns from pandas apply()
- How to slice a pandas DataFrame by position?
- Python Pandas – Merge based on substring in string
- Filling in date gaps in MultiIndex Pandas Dataframe
- append dictionary to data frame
- Find unique values in a Pandas dataframe, irrespective of row or column location
- What values are valid in Pandas ‘Freq’ tags?
- How to convert DataFrame.append() to pandas.concat()?
- How to efficiently assign unique ID to individuals with multiple entries based on name in very large df
- start index at 1 for Pandas DataFrame