@ -3970,7 +3970,7 @@
},
{
"cell_type": "code",
"execution_count": 91 ,
"execution_count": 2 ,
"metadata": {},
"outputs": [],
"source": [
@ -3982,7 +3982,7 @@
},
{
"cell_type": "code",
"execution_count": 92 ,
"execution_count": 3 ,
"metadata": {},
"outputs": [
{
@ -4074,7 +4074,7 @@
"4 True "
]
},
"execution_count": 92 ,
"execution_count": 3 ,
"metadata": {},
"output_type": "execute_result"
}
@ -4086,7 +4086,7 @@
},
{
"cell_type": "code",
"execution_count": 9 4,
"execution_count": 4,
"metadata": {},
"outputs": [
{
@ -4178,7 +4178,7 @@
"4 True "
]
},
"execution_count": 9 4,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
@ -4191,7 +4191,7 @@
},
{
"cell_type": "code",
"execution_count": 9 5,
"execution_count": 5,
"metadata": {},
"outputs": [
{
@ -4276,7 +4276,7 @@
"4 3377906280028510514 2017-03-01 2017-03-01 06:18:00 1.682314 True"
]
},
"execution_count": 9 5,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@ -4288,7 +4288,7 @@
},
{
"cell_type": "code",
"execution_count": 98 ,
"execution_count": 6 ,
"metadata": {},
"outputs": [
{
@ -4419,7 +4419,7 @@
"7 False 1.671675 "
]
},
"execution_count": 98 ,
"execution_count": 6 ,
"metadata": {},
"output_type": "execute_result"
}
@ -4439,7 +4439,7 @@
},
{
"cell_type": "code",
"execution_count": 99 ,
"execution_count": 7 ,
"metadata": {},
"outputs": [],
"source": [
@ -4454,7 +4454,7 @@
},
{
"cell_type": "code",
"execution_count": 100 ,
"execution_count": 8 ,
"metadata": {},
"outputs": [],
"source": [
@ -4470,7 +4470,7 @@
},
{
"cell_type": "code",
"execution_count": 101 ,
"execution_count": 9 ,
"metadata": {},
"outputs": [],
"source": [
@ -4481,7 +4481,7 @@
},
{
"cell_type": "code",
"execution_count": 102 ,
"execution_count": 10,
"metadata": {},
"outputs": [
{
@ -4648,7 +4648,7 @@
"7 False 1.629241 1.629241 1.682314 1.676886 1.671675 "
]
},
"execution_count": 102 ,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@ -4659,7 +4659,7 @@
},
{
"cell_type": "code",
"execution_count": 103 ,
"execution_count": 11 ,
"metadata": {},
"outputs": [],
"source": [
@ -4669,7 +4669,7 @@
},
{
"cell_type": "code",
"execution_count": 104 ,
"execution_count": 12 ,
"metadata": {},
"outputs": [],
"source": [
@ -4680,7 +4680,7 @@
},
{
"cell_type": "code",
"execution_count": 127 ,
"execution_count": 13 ,
"metadata": {},
"outputs": [],
"source": [
@ -4691,7 +4691,7 @@
},
{
"cell_type": "code",
"execution_count": 128 ,
"execution_count": 14 ,
"metadata": {},
"outputs": [
{
@ -4844,7 +4844,7 @@
"4 3 2 144 "
]
},
"execution_count": 128 ,
"execution_count": 14 ,
"metadata": {},
"output_type": "execute_result"
}
@ -4855,7 +4855,7 @@
},
{
"cell_type": "code",
"execution_count": 129 ,
"execution_count": 15 ,
"metadata": {},
"outputs": [],
"source": [
@ -4869,7 +4869,7 @@
},
{
"cell_type": "code",
"execution_count": 130 ,
"execution_count": 16 ,
"metadata": {},
"outputs": [
{
@ -5028,7 +5028,7 @@
"4 3 2 144 0.0 "
]
},
"execution_count": 130 ,
"execution_count": 16 ,
"metadata": {},
"output_type": "execute_result"
}
@ -5039,7 +5039,7 @@
},
{
"cell_type": "code",
"execution_count": 131 ,
"execution_count": 17 ,
"metadata": {},
"outputs": [],
"source": [
@ -5056,7 +5056,7 @@
},
{
"cell_type": "code",
"execution_count": 133 ,
"execution_count": 18 ,
"metadata": {},
"outputs": [
{
@ -5221,7 +5221,7 @@
"4 3 2 144 0.0 8.0 "
]
},
"execution_count": 133 ,
"execution_count": 18 ,
"metadata": {},
"output_type": "execute_result"
}
@ -5232,7 +5232,7 @@
},
{
"cell_type": "code",
"execution_count": 136 ,
"execution_count": 19 ,
"metadata": {},
"outputs": [],
"source": [
@ -5245,7 +5245,7 @@
},
{
"cell_type": "code",
"execution_count": 137 ,
"execution_count": 20 ,
"metadata": {},
"outputs": [],
"source": [
@ -5257,7 +5257,7 @@
},
{
"cell_type": "code",
"execution_count": 138 ,
"execution_count": 2 1,
"metadata": {},
"outputs": [],
"source": [
@ -5267,7 +5267,7 @@
},
{
"cell_type": "code",
"execution_count": 139 ,
"execution_count": 22 ,
"metadata": {},
"outputs": [
{
@ -5463,7 +5463,7 @@
"4 1.0 1.0 1.0,1.0 "
]
},
"execution_count": 139 ,
"execution_count": 22 ,
"metadata": {},
"output_type": "execute_result"
}
@ -5474,7 +5474,7 @@
},
{
"cell_type": "code",
"execution_count": 140 ,
"execution_count": 23 ,
"metadata": {},
"outputs": [],
"source": [
@ -5483,7 +5483,7 @@
},
{
"cell_type": "code",
"execution_count": 141 ,
"execution_count": 24 ,
"metadata": {},
"outputs": [],
"source": [
@ -5494,57 +5494,16 @@
},
{
"cell_type": "code",
"execution_count": 143 ,
"execution_count": 25 ,
"metadata": {},
"outputs": [
{
"ename": "MemoryError",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mMemoryError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\groupby.py\u001b[0m in \u001b[0;36mapply\u001b[1;34m(self, func, *args, **kwargs)\u001b[0m\n\u001b[0;32m 688\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 689\u001b[1;33m \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_python_apply_general\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 690\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mException\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\groupby.py\u001b[0m in \u001b[0;36m_python_apply_general\u001b[1;34m(self, f)\u001b[0m\n\u001b[0;32m 706\u001b[0m keys, values, mutated = self.grouper.apply(f, self._selected_obj,\n\u001b[1;32m--> 707\u001b[1;33m self.axis)\n\u001b[0m\u001b[0;32m 708\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\ops.py\u001b[0m in \u001b[0;36mapply\u001b[1;34m(self, f, data, axis)\u001b[0m\n\u001b[0;32m 165\u001b[0m \u001b[0mmutated\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmutated\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 166\u001b[1;33m \u001b[0msplitter\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_splitter\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 167\u001b[0m \u001b[0mgroup_keys\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_group_keys\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\ops.py\u001b[0m in \u001b[0;36m_get_splitter\u001b[1;34m(self, data, axis)\u001b[0m\n\u001b[0;32m 148\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_get_splitter\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 149\u001b[1;33m \u001b[0mcomp_ids\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0m_\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mngroups\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgroup_info\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 150\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mget_splitter\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcomp_ids\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mngroups\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mpandas/_libs/properties.pyx\u001b[0m in \u001b[0;36mpandas._libs.properties.CachedProperty.__get__\u001b[1;34m()\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\ops.py\u001b[0m in \u001b[0;36mgroup_info\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 251\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mgroup_info\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 252\u001b[1;33m \u001b[0mcomp_ids\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mobs_group_ids\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_compressed_labels\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 253\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\ops.py\u001b[0m in \u001b[0;36m_get_compressed_labels\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 267\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_get_compressed_labels\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 268\u001b[1;33m \u001b[0mall_labels\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mping\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlabels\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mping\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgroupings\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 269\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mall_labels\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m>\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\ops.py\u001b[0m in \u001b[0;36m<listcomp>\u001b[1;34m(.0)\u001b[0m\n\u001b[0;32m 267\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_get_compressed_labels\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 268\u001b[1;33m \u001b[0mall_labels\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mping\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlabels\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mping\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgroupings\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 269\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mall_labels\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m>\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\grouper.py\u001b[0m in \u001b[0;36mlabels\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 366\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_labels\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 367\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_make_labels\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 368\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_labels\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\grouper.py\u001b[0m in \u001b[0;36m_make_labels\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 391\u001b[0m labels, uniques = algorithms.factorize(\n\u001b[1;32m--> 392\u001b[1;33m self.grouper, sort=self.sort)\n\u001b[0m\u001b[0;32m 393\u001b[0m \u001b[0muniques\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mIndex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0muniques\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\util\\_decorators.py\u001b[0m in \u001b[0;36mwrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 187\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mnew_arg_name\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnew_arg_value\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 188\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 189\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\algorithms.py\u001b[0m in \u001b[0;36mfactorize\u001b[1;34m(values, sort, order, na_sentinel, size_hint)\u001b[0m\n\u001b[0;32m 612\u001b[0m \u001b[0msize_hint\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0msize_hint\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 613\u001b[1;33m na_value=na_value)\n\u001b[0m\u001b[0;32m 614\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\algorithms.py\u001b[0m in \u001b[0;36m_factorize_array\u001b[1;34m(values, na_sentinel, size_hint, na_value)\u001b[0m\n\u001b[0;32m 459\u001b[0m uniques, labels = table.factorize(values, na_sentinel=na_sentinel,\n\u001b[1;32m--> 460\u001b[1;33m na_value=na_value)\n\u001b[0m\u001b[0;32m 461\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.StringHashTable.factorize\u001b[1;34m()\u001b[0m\n",
"\u001b[1;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.StringHashTable._unique\u001b[1;34m()\u001b[0m\n",
"\u001b[1;31mMemoryError\u001b[0m: ",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[1;31mMemoryError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-143-24f768089ddb>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdf2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdf2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgroupby\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'link_ID'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmean_time\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\groupby.py\u001b[0m in \u001b[0;36mapply\u001b[1;34m(self, func, *args, **kwargs)\u001b[0m\n\u001b[0;32m 699\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 700\u001b[0m \u001b[1;32mwith\u001b[0m \u001b[0m_group_selection_context\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 701\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_python_apply_general\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 702\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 703\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\groupby.py\u001b[0m in \u001b[0;36m_python_apply_general\u001b[1;34m(self, f)\u001b[0m\n\u001b[0;32m 704\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 705\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_python_apply_general\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 706\u001b[1;33m keys, values, mutated = self.grouper.apply(f, self._selected_obj,\n\u001b[0m\u001b[0;32m 707\u001b[0m self.axis)\n\u001b[0;32m 708\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mpandas/_libs/properties.pyx\u001b[0m in \u001b[0;36mpandas._libs.properties.CachedProperty.__get__\u001b[1;34m()\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby\\groupby.py\u001b[0m in \u001b[0;36m_selected_obj\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 464\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_selection\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mSeries\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 465\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_group_selection\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 466\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_group_selection\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 467\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 468\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\frame.py\u001b[0m in \u001b[0;36m__getitem__\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m 2938\u001b[0m \u001b[0mindexer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwhere\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2939\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2940\u001b[1;33m \u001b[0mdata\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_take\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2941\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2942\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mis_single_key\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\generic.py\u001b[0m in \u001b[0;36m_take\u001b[1;34m(self, indices, axis, is_copy)\u001b[0m\n\u001b[0;32m 3357\u001b[0m new_data = self._data.take(indices,\n\u001b[0;32m 3358\u001b[0m \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_block_manager_axis\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 3359\u001b[1;33m verify=True)\n\u001b[0m\u001b[0;32m 3360\u001b[0m \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_constructor\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnew_data\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__finalize__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3361\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\internals\\managers.py\u001b[0m in \u001b[0;36mtake\u001b[1;34m(self, indexer, axis, verify, convert)\u001b[0m\n\u001b[0;32m 1348\u001b[0m \u001b[0mnew_labels\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0maxes\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtake\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1349\u001b[0m return self.reindex_indexer(new_axis=new_labels, indexer=indexer,\n\u001b[1;32m-> 1350\u001b[1;33m axis=axis, allow_dups=True)\n\u001b[0m\u001b[0;32m 1351\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1352\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mmerge\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mother\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlsuffix\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m''\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mrsuffix\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m''\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\internals\\managers.py\u001b[0m in \u001b[0;36mreindex_indexer\u001b[1;34m(self, new_axis, indexer, axis, fill_value, allow_dups, copy)\u001b[0m\n\u001b[0;32m 1229\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0maxis\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1230\u001b[0m new_blocks = self._slice_take_blocks_ax0(indexer,\n\u001b[1;32m-> 1231\u001b[1;33m fill_tuple=(fill_value,))\n\u001b[0m\u001b[0;32m 1232\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1233\u001b[0m new_blocks = [blk.take_nd(indexer, axis=axis, fill_tuple=(\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\internals\\managers.py\u001b[0m in \u001b[0;36m_slice_take_blocks_ax0\u001b[1;34m(self, slice_or_indexer, fill_tuple)\u001b[0m\n\u001b[0;32m 1310\u001b[0m blocks.append(blk.take_nd(blklocs[mgr_locs.indexer],\n\u001b[0;32m 1311\u001b[0m \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnew_mgr_locs\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mmgr_locs\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1312\u001b[1;33m fill_tuple=None))\n\u001b[0m\u001b[0;32m 1313\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1314\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mblocks\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\internals\\blocks.py\u001b[0m in \u001b[0;36mtake_nd\u001b[1;34m(self, indexer, axis, new_mgr_locs, fill_tuple)\u001b[0m\n\u001b[0;32m 1232\u001b[0m \u001b[0mfill_value\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfill_value\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1233\u001b[0m new_values = algos.take_nd(values, indexer, axis=axis,\n\u001b[1;32m-> 1234\u001b[1;33m allow_fill=False, fill_value=fill_value)\n\u001b[0m\u001b[0;32m 1235\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1236\u001b[0m \u001b[0mfill_value\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mfill_tuple\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\algorithms.py\u001b[0m in \u001b[0;36mtake_nd\u001b[1;34m(arr, indexer, axis, out, fill_value, mask_info, allow_fill)\u001b[0m\n\u001b[0;32m 1649\u001b[0m \u001b[0mout\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mout_shape\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0morder\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'F'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1650\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1651\u001b[1;33m \u001b[0mout\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mout_shape\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1652\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1653\u001b[0m func = _get_take_nd_function(arr.ndim, arr.dtype, out.dtype, axis=axis,\n",
"\u001b[1;31mMemoryError\u001b[0m: "
]
}
],
"outputs": [],
"source": [
"df2 = df2.groupby('link_ID').apply(mean_time)"
]
},
{
"cell_type": "code",
"execution_count": null ,
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
@ -5554,21 +5513,235 @@
},
{
"cell_type": "code",
"execution_count": null ,
"execution_count": 27 ,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>link_ID</th>\n",
" <th>date</th>\n",
" <th>time_interval_begin</th>\n",
" <th>travel_time</th>\n",
" <th>imputationl</th>\n",
" <th>lagging1</th>\n",
" <th>lagging2</th>\n",
" <th>lagging3</th>\n",
" <th>lagging4</th>\n",
" <th>lagging5</th>\n",
" <th>...</th>\n",
" <th>links_num_2</th>\n",
" <th>links_num_3</th>\n",
" <th>links_num_4</th>\n",
" <th>links_num_5</th>\n",
" <th>width_3</th>\n",
" <th>width_6</th>\n",
" <th>width_9</th>\n",
" <th>width_12</th>\n",
" <th>width_15</th>\n",
" <th>link_ID_en</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>3377906280028510514</td>\n",
" <td>2017-03-01</td>\n",
" <td>2017-03-01 06:00:00</td>\n",
" <td>1.659311</td>\n",
" <td>True</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>3377906280028510514</td>\n",
" <td>2017-03-01</td>\n",
" <td>2017-03-01 06:02:00</td>\n",
" <td>1.664941</td>\n",
" <td>True</td>\n",
" <td>1.659311</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3377906280028510514</td>\n",
" <td>2017-03-01</td>\n",
" <td>2017-03-01 06:04:00</td>\n",
" <td>1.671675</td>\n",
" <td>True</td>\n",
" <td>1.664941</td>\n",
" <td>1.659311</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3377906280028510514</td>\n",
" <td>2017-03-01</td>\n",
" <td>2017-03-01 06:06:00</td>\n",
" <td>1.676886</td>\n",
" <td>True</td>\n",
" <td>1.671675</td>\n",
" <td>1.664941</td>\n",
" <td>1.659311</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>3377906280028510514</td>\n",
" <td>2017-03-01</td>\n",
" <td>2017-03-01 06:08:00</td>\n",
" <td>1.682314</td>\n",
" <td>True</td>\n",
" <td>1.676886</td>\n",
" <td>1.671675</td>\n",
" <td>1.664941</td>\n",
" <td>1.659311</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>47</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 36 columns</p>\n",
"</div>"
],
"text/plain": [
" link_ID date time_interval_begin travel_time \\\n",
"0 3377906280028510514 2017-03-01 2017-03-01 06:00:00 1.659311 \n",
"1 3377906280028510514 2017-03-01 2017-03-01 06:02:00 1.664941 \n",
"2 3377906280028510514 2017-03-01 2017-03-01 06:04:00 1.671675 \n",
"3 3377906280028510514 2017-03-01 2017-03-01 06:06:00 1.676886 \n",
"4 3377906280028510514 2017-03-01 2017-03-01 06:08:00 1.682314 \n",
"\n",
" imputationl lagging1 lagging2 lagging3 lagging4 lagging5 ... \\\n",
"0 True NaN NaN NaN NaN NaN ... \n",
"1 True 1.659311 NaN NaN NaN NaN ... \n",
"2 True 1.664941 1.659311 NaN NaN NaN ... \n",
"3 True 1.671675 1.664941 1.659311 NaN NaN ... \n",
"4 True 1.676886 1.671675 1.664941 1.659311 NaN ... \n",
"\n",
" links_num_2 links_num_3 links_num_4 links_num_5 width_3 width_6 \\\n",
"0 1 0 0 0 1 0 \n",
"1 1 0 0 0 1 0 \n",
"2 1 0 0 0 1 0 \n",
"3 1 0 0 0 1 0 \n",
"4 1 0 0 0 1 0 \n",
"\n",
" width_9 width_12 width_15 link_ID_en \n",
"0 0 0 0 47 \n",
"1 0 0 0 47 \n",
"2 0 0 0 47 \n",
"3 0 0 0 47 \n",
"4 0 0 0 47 \n",
"\n",
"[5 rows x 36 columns]"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 32 ,
"metadata": {},
"outputs": [],
"source": [
"df2.to_csv('com_trainning.txt',header=True,index=None,sep=';',mode='w')"
"df2.to_csv('trainning.txt',header=True,index=None,sep=';',mode='w')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {