import pandas as pd
# Example data and char arrays
data = [[1, 2, 3] for i in range(300)]
char = [i for i in range(300)]
combined = list(zip(char, data))
grouped = {}
for c, d in combined:
if c not in grouped:
grouped[c] = []
grouped[c].append(d)
dict_list = []
for c in range(300):
dict_list.append({'char': c, 'data': grouped[c]})
# Assign the list of dictionaries to x[0]
x = [dict_list]
values = [[d['char']] + d['data'] for d in dict_list]
# Assign the values to x[0]
x = [values]
1条答案
按热度按时间6gpjuf901#
您可以执行以下操作:
其给出: