I have an application that will open many files and will convert these files into a pandas data frame. I want to ensure that all pandas' data frames have the same structure so I want to create a warning if the number of the column is not equal that 10. I also want to know which file was the one that arise the warning.
How can I introduce the file_name into the warning message?
def load_data(self):
some code
file_name = file_name
if df.shape[1] !=10:
warning.warns("File_name is wrong"
return pandas_df2