Creating a dataframe from contents of multiple files in a folder

How to write a program that can access all the files in a given folder. Each file contains a single line string and we need to store the file name as well as the content of the file in a dataframe and return the csv file. how to solve this question ?

Hey @ishabehera, read about os.listdir() function, with the help of this you will be able to access all file names of all files in the folder. For making the dataframe, you could first makes list of the data, append data by iterating over it. And than finally you can convert this list into dataframe.

Hope this resolved your doubt.
Plz mark the doubt as resolved in my doubts section. :slight_smile: