i have a CSV file which name is data.CSV and i want to make column from file name for example data is column and value must be data as well how can i do this?
You could use
os.listdir() in order to get the file name:
import os file_name = os.listdir() # you need to use the path to the directory of the file file_name_noext = file_name.replace(".csv", "") # in order to remove the .csv part
Now if you have a
import pandas as pd data = pd.DataFrame() data[file_name_noext] = file_name_noext # to update the dataframe