50459/how-to-check-if-a-csv-file-is-empty-in-pandas
Try this code:
import pandas as pd df = pd.read_csv(filename) if(df.empty): print ('CSV file is empty') else: print ('CSV file is not empty')
Try this:
df = pd.DataFrame(columns=['Name', 'ID', 'Department']) if df.empty == True: print('DataFrame is empty') else: print('DataFrame is not empty')
Hi, Try the below given code: with open('myfile.txt') as ...READ MORE
Hello @kartik, If you need to know how ...READ MORE
Try this: if cookie and not cookie.isspace(): # the ...READ MORE
Hey @Vedant, that's pretty simple and straightforward: if ...READ MORE
Hello @kartik, I use the len function. It's much faster ...READ MORE
Hello @kartik, You can use the following code: if ...READ MORE
Hello @kartik, Basically instead of raising exception I ...READ MORE
Hello, A function that returns True for an integer number (int or ...READ MORE
To check if a list is empty ...READ MORE
To check if the substring exists in ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.