请告知如何执行以下排列:
array = [1, 3, 2] # numpy.ndarray
l1 = ['foo_qwe1_ert1', 'bar_qwe2_ert2', 'baz_qwe3_ert3'] # list
字符串
我需要得到以下的pandas框架:
| Column1| Column2| Column3|
| --|--|--|
| Foo| qwe1| ert 1|
| Baz| Qwe3| ert 3|
| 酒吧|Qwe2| ERT2|
问题是列表包含从0到30的文本标签(格式:XXX_YYY_ZZZ)和numpy。数组具有形状(3536,),并包含从0到30的数字。我需要为数组中的每个数字分配标签,并将其保存为pandas字符串
1条答案
按热度按时间ff29svar1#
首先使用
DataFrame
构造函数和split
:字符串
然后通过从最后一列中提取最后一个整数来改变
array
的顺序:型
编辑:
型
或者:
的字符串