对于一个(x,y,z) 的三维立体空间,生成[‘x’,‘y’,‘z’]这样的dataframe序列:
import pandas as pd
import numpy as np
# x = 30 ,y = 20, z = 5
_x_size_temp = 30
_y_size_temp = 20
_z_size_temp = 5
_x_se = []
for _ in range(_x_size_temp):
_x_se += [_] * (_y_size_temp * _z_size_temp)
_y_se = []
for _ in range(_y_size_temp):
_y_se += [_] * (_z_size_temp)
_y_se *= _x_size_temp
_z_se = []
_z_se = np.arange(0, _z_size_temp).tolist() * (_x_size_temp * _y_size_temp)
cargo_state_3d = pd.DataFrame(data={
'x': _x_se,
'y': _y_se,
'z': _z_se,
})