I have a set of videos in different folders. Each time that a video is selected, I want to save some properties of that video file, like the name of the video, its directory, and the number of frames in a csv file. I use pandas dataframe for that, creating a separate csv file for each video. something like this:
import pandas as pd
import os
listOfLabels = pd.DataFrame([])
listOfLabels.append(pd.DataFrame({'video name': os.path.basename(path),
'video path': os.path.dirname(path),
'Number of frames': totalFrameNumber},
index=[0]), ignore_index=True)
dirName = 'C:/Users/bert/PycharmProjects/csvFiles'
fileName = os.path.splitext(os.path.basename(path))[0]
fileNameSuffix = 'csv'
csvPathAndName = os.path.join(dirName, fileName + '.' + fileNameSuffix)
listOfLabels.to_csv(csvPathAndName)
where path is the path to the video file, and totalFrameNumber is the number of frames in the video. I know the dirName, fileName, totalFrameNumber, video name, and video path all exist and are correct. The problem is that nothing get appended to the listOfLabels, and although the csv file is created, it is empty. My question is what I am doing wrong when I append the data into listOfLabels.