There is a list of 1150 items and a ready-made data frame with 10 columns. It is necessary to drive the 1st, 11th, 21st, and so on element in the first column of the data frame; 2nd, 12th and so on in the second column, similarly with the other elements.

data = pd.DataFrame(columns = ['0','1','2','3','4','5','6','7','8','9']) #готовый датафрейм resultlist = ['71', '45', '18', '77', '64', 'Moy', '12', '92', '21' ...] #список 

    1 answer 1

    After converting the list to the Numpy array, it can easily be transformed into a 2D matrix with ten columns:

     import numpy as np import pandas as pd In [32]: lst = list(range(1, 1151)) In [33]: df = pd.DataFrame(np.array(lst).reshape(-1, 10)) In [34]: df Out[34]: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 10 1 11 12 13 14 15 16 17 18 19 20 2 21 22 23 24 25 26 27 28 29 30 3 31 32 33 34 35 36 37 38 39 40 4 41 42 43 44 45 46 47 48 49 50 5 51 52 53 54 55 56 57 58 59 60 6 61 62 63 64 65 66 67 68 69 70 7 71 72 73 74 75 76 77 78 79 80 8 81 82 83 84 85 86 87 88 89 90 9 91 92 93 94 95 96 97 98 99 100 .. ... ... ... ... ... ... ... ... ... ... 105 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 106 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 107 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 108 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 109 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 110 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 111 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 112 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 113 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 114 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 [115 rows x 10 columns] 

    UPDATE:

     In [38]: data = pd.DataFrame(np.array(lst).reshape(-1, 10), columns=data.columns) In [39]: data Out[39]: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 10 1 11 12 13 14 15 16 17 18 19 20 2 21 22 23 24 25 26 27 28 29 30 3 31 32 33 34 35 36 37 38 39 40 4 41 42 43 44 45 46 47 48 49 50 5 51 52 53 54 55 56 57 58 59 60 6 61 62 63 64 65 66 67 68 69 70 7 71 72 73 74 75 76 77 78 79 80 8 81 82 83 84 85 86 87 88 89 90 9 91 92 93 94 95 96 97 98 99 100 .. ... ... ... ... ... ... ... ... ... ... 105 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 106 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 107 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 108 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 109 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 110 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 111 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 112 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 113 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 114 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 [115 rows x 10 columns] In [40]: data.columns Out[40]: Index(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], dtype='object') 
    • I understand that you are creating a new data frame, and I need to drive it into the already ready one. (just so necessary) - Pupkin Putya February
    • one
      @PupkinPuta, "Ready DataFrame" is empty? - MaxU
    • @ MaxU Yes, empty - Pupkin Putya February
    • @PupkinPutya, see UPDATE - MaxU