import numpy as np
import pandas as pd
n_videos = 2
n_channels = 3
n_points = 4
# Generate data
A = np.arange(n_videos * n_channels * n_points).reshape(n_videos,
n_channels,
n_points)
col_names = ["Channel_{}".format(i) for i in range(n_channels)]
# Need to re-order axis before reshape.
# Want axis correspoonding to videos to be at first axis.
df = pd.DataFrame(np.rollaxis(A, 2, 1).reshape(-1, n_channels),
columns=col_names)
video_idx = np.hstack((np.full((n_points,), i) for i in range(n_videos)))
video_idx = pd.Series(video_idx, name="Video")
df.insert(0, "Video", video_idx)