I'm a total beginner at Python. I've got multiple csv files for different video outputs stored in different folders.
1st: I want Python to read in all the csv files. Works with the following code:
frames = []
indices = []
for folder in os.listdir(path):
for file in os.listdir(path+folder):
if 'faces' in file and 'FrameLevel' in file:
# print(file)
df = pd.read_csv(path+'/'+folder+'/'+file)
vid = file[:12]
print(vid)
indices.append(vid)
df.insert(0,'vid',vid)
frames.append(df)
This is how the dataframe looks like then: df
2nd: I want Python to read every csv file and a add new rows every 2nd row with specific values. So I want to extend every csv file in order to add new information. E.g. for video file V2ID_35_0638. The "New" first (0) row would look like this: V2ID_35_0638, 180.0, 5.0, 0 The 2nd (1) row would be the "old" first (0) row: V2ID_35_0638, 360.0, 10.0, 0 The 3rd row (2) would then be V2ID_35_0638, 580.0, 15.0, 0 The 4th row (3) would be the "old" 2nd (1) row: V2ID_35_0638, 760.0, 20.0, 0 ...
The 'vid' will always stay the same, 'time' increases by 400.0, frame increase by 10.
I hope you get what I mean.
Best