I am new to python specially pandas library.This is my code.
file_path = "C:\\Users\\Roshaan\\Desktop\\"
b = os.listdir(file_path)
f = 1
for file in b:
def func():
print("format not supported")
#prints file name i.e test.csv
print(file)
path = file_path + file
df = pd.read_csv(path) if file.endswith(('.csv', '.tsv')) else func()
print (df.head(1))
This is the error I am facing.
AttributeError: 'NoneType' object has no attribute 'head'