1 2 3 4 5 6 |
import pandas as pd dict=[[1,2,3,4,5,6],[2,3,4,5,6,7],[3,4,5,6,7,8],[4,5,6,7,8,9],[5,6,7,8,9,10]] data=pd.DataFrame(dict) print(data) for indexs in data.index: print(data.loc[indexs].values[0:-1]) |
实验结果:
0 1 2 3 4 5
0 1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
[1 2 3 4 5]
[2 3 4 5 6]
[3 4 5 6 7]
[4 5 6 7 8]
[5 6 7 8 9]
原文地址:https://www.cnblogs.com/jiqima/p/10270786.html
时间: 2024-11-08 05:23:05