Python generates (x, y, z) 3D coordinate sequence

For a (x, y, z) three-dimensional space, the dataframe sequence of [‘x ‘,’y’,’z ‘] is generated

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,
})


Read More: