{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "##按天读取数据" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "data=pd.read_excel(\"plclog20230610.xlsx\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "##数据清洗" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "data=data[data[\"x_v\"]!=100]" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "##数据分段" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/2225437407.py:2: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " data[\"change_status\"][data[\"steps\"]!=0]=1\n" ] } ], "source": [ "data[\"change_status\"]=0\n", "data[\"change_status\"][data[\"steps\"]!=0]=1\n", "data[\"change_flag\"]=(data[\"change_status\"] != data[\"change_status\"].shift(1)).astype(int).cumsum()\n", "data = data.drop('change_status', axis=1)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timesnstepsstatusx_vy_vz_vr_vpausex_s...deflect2pushrod2_out_timepushrod3_out_timepushrod2_in_timepushrod3_in_timepushrod1_out_timepushrod4_out_timepushrod1_in_timepushrod4_in_timechange_flag
02023-06-10 00:00:00.086plc00-0.1498030.000000-0.0086020.0572200.0-443.670004...1.145913e-3090.00.00.00.05000.05000.05000.05000.01
12023-06-10 00:00:00.186plc000.2247040.0000000.0000000.0381470.0-443.669985...1.145913e-3090.00.00.00.05000.05000.05000.05000.01
22023-06-10 00:00:00.286plc00-0.0749010.0000000.008602-0.0381470.0-443.670004...1.145913e-3090.00.00.00.05000.05000.05000.05000.01
32023-06-10 00:00:00.386plc000.0000000.075462-0.038710-0.0190730.0-443.669999...1.145913e-3090.00.00.00.05000.05000.05000.05000.01
42023-06-10 00:00:00.486plc000.0000000.000000-0.0086020.0190730.0-443.669990...1.145913e-3090.00.00.00.05000.05000.05000.05000.01
\n", "

5 rows × 113 columns

\n", "
" ], "text/plain": [ " time sn steps status x_v y_v z_v \\\n", "0 2023-06-10 00:00:00.086 plc 0 0 -0.149803 0.000000 -0.008602 \n", "1 2023-06-10 00:00:00.186 plc 0 0 0.224704 0.000000 0.000000 \n", "2 2023-06-10 00:00:00.286 plc 0 0 -0.074901 0.000000 0.008602 \n", "3 2023-06-10 00:00:00.386 plc 0 0 0.000000 0.075462 -0.038710 \n", "4 2023-06-10 00:00:00.486 plc 0 0 0.000000 0.000000 -0.008602 \n", "\n", " r_v pause x_s ... deflect2 pushrod2_out_time \\\n", "0 0.057220 0.0 -443.670004 ... 1.145913e-309 0.0 \n", "1 0.038147 0.0 -443.669985 ... 1.145913e-309 0.0 \n", "2 -0.038147 0.0 -443.670004 ... 1.145913e-309 0.0 \n", "3 -0.019073 0.0 -443.669999 ... 1.145913e-309 0.0 \n", "4 0.019073 0.0 -443.669990 ... 1.145913e-309 0.0 \n", "\n", " pushrod3_out_time pushrod2_in_time pushrod3_in_time pushrod1_out_time \\\n", "0 0.0 0.0 0.0 5000.0 \n", "1 0.0 0.0 0.0 5000.0 \n", "2 0.0 0.0 0.0 5000.0 \n", "3 0.0 0.0 0.0 5000.0 \n", "4 0.0 0.0 0.0 5000.0 \n", "\n", " pushrod4_out_time pushrod1_in_time pushrod4_in_time change_flag \n", "0 5000.0 5000.0 5000.0 1 \n", "1 5000.0 5000.0 5000.0 1 \n", "2 5000.0 5000.0 5000.0 1 \n", "3 5000.0 5000.0 5000.0 1 \n", "4 5000.0 5000.0 5000.0 1 \n", "\n", "[5 rows x 113 columns]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data.head()" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "#准备状态的情况" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "data0=data[data[\"steps\"]==0]" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "data_in=data[data[\"steps\"]!=0]" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "##换电过程的个数" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timesnstepsstatusx_vy_vz_vr_vpausex_s...deflect2pushrod2_out_timepushrod3_out_timepushrod2_in_timepushrod3_in_timepushrod1_out_timepushrod4_out_timepushrod1_in_timepushrod4_in_timechange_flag
111602023-06-10 00:18:36.086plc4433.2956610.000000-0.1075270.0190730.0-443.611412...1.145913e-3090.00.00.00.05000.05000.05000.05000.02
111612023-06-10 00:18:36.186plc44313.2575460.075462-3.5010750.0000000.0-442.760925...1.145913e-3090.00.00.00.05000.05000.05000.05000.02
111622023-06-10 00:18:36.286plc44323.0696280.150925-6.516129-0.0572200.0-440.914503...1.145913e-3090.00.00.00.05000.05000.05000.05000.02
111632023-06-10 00:18:36.386plc44333.930330-0.226387-9.548387-0.0190730.0-438.066691...1.145913e-3090.00.00.00.05000.05000.05000.05000.02
111642023-06-10 00:18:36.486plc44344.1169190.377312-12.4602150.0190730.0-434.220631...1.145913e-3090.00.00.00.05000.05000.05000.05000.02
\n", "

5 rows × 113 columns

\n", "
" ], "text/plain": [ " time sn steps status x_v y_v \\\n", "11160 2023-06-10 00:18:36.086 plc 44 3 3.295661 0.000000 \n", "11161 2023-06-10 00:18:36.186 plc 44 3 13.257546 0.075462 \n", "11162 2023-06-10 00:18:36.286 plc 44 3 23.069628 0.150925 \n", "11163 2023-06-10 00:18:36.386 plc 44 3 33.930330 -0.226387 \n", "11164 2023-06-10 00:18:36.486 plc 44 3 44.116919 0.377312 \n", "\n", " z_v r_v pause x_s ... deflect2 \\\n", "11160 -0.107527 0.019073 0.0 -443.611412 ... 1.145913e-309 \n", "11161 -3.501075 0.000000 0.0 -442.760925 ... 1.145913e-309 \n", "11162 -6.516129 -0.057220 0.0 -440.914503 ... 1.145913e-309 \n", "11163 -9.548387 -0.019073 0.0 -438.066691 ... 1.145913e-309 \n", "11164 -12.460215 0.019073 0.0 -434.220631 ... 1.145913e-309 \n", "\n", " pushrod2_out_time pushrod3_out_time pushrod2_in_time \\\n", "11160 0.0 0.0 0.0 \n", "11161 0.0 0.0 0.0 \n", "11162 0.0 0.0 0.0 \n", "11163 0.0 0.0 0.0 \n", "11164 0.0 0.0 0.0 \n", "\n", " pushrod3_in_time pushrod1_out_time pushrod4_out_time \\\n", "11160 0.0 5000.0 5000.0 \n", "11161 0.0 5000.0 5000.0 \n", "11162 0.0 5000.0 5000.0 \n", "11163 0.0 5000.0 5000.0 \n", "11164 0.0 5000.0 5000.0 \n", "\n", " pushrod1_in_time pushrod4_in_time change_flag \n", "11160 5000.0 5000.0 2 \n", "11161 5000.0 5000.0 2 \n", "11162 5000.0 5000.0 2 \n", "11163 5000.0 5000.0 2 \n", "11164 5000.0 5000.0 2 \n", "\n", "[5 rows x 113 columns]" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data_in.head()" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "groups=set(data_in[\"change_flag\"])" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "change_num=len(groups)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "142" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "change_num" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "##每个换电过程的换电步骤数" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "##排除换电为50的步骤" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "data_in=data_in[data_in[\"steps\"]!=50]" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "change_steps= data_in.groupby('change_flag')['steps'].nunique()" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "change_steps=change_steps.reset_index()" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "##增加一个字段来区分是否是完整的换电过程,完成的是44" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "change_steps[\"full_steps\"]=1" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [], "source": [ "change_steps[\"full_steps\"][change_steps[\"steps\"]!=44]=0" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [], "source": [ "##换电过程的耗时统计" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [], "source": [ "change_time=data_in.groupby(\"change_flag\").apply(lambda x: pd.concat([x.head(1), x.tail(1)]))" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [], "source": [ "change_time_group=change_time.reset_index(drop=True)" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [], "source": [ "change_time_group=change_time_group[['time','steps','change_flag']]" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [], "source": [ "change_time_group[\"time2\"]=change_time_group[\"time\"].shift(1)" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [], "source": [ "change_time_group=change_time_group.groupby('change_flag').tail(1)" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [], "source": [ "change_time_group[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(change_time_group[\"time\"])-pd.to_datetime(change_time_group[\"time2\"])).dt.total_seconds()" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timestepschange_flagtime2time_delta
12023-06-10 00:18:46.9864422023-06-10 00:18:36.08610.9
32023-06-10 00:55:00.5864442023-06-10 00:49:56.286304.3
52023-06-10 01:08:58.7864462023-06-10 01:03:54.686304.1
72023-06-10 01:24:09.8864482023-06-10 01:11:08.686781.2
92023-06-10 01:45:54.38644102023-06-10 01:45:52.4861.9
..................
2752023-06-10 23:42:35.686442762023-06-10 23:37:35.386300.3
2772023-06-10 23:47:57.686442782023-06-10 23:42:57.886299.8
2792023-06-10 23:53:16.886442802023-06-10 23:48:16.686300.2
2812023-06-10 23:58:44.086442822023-06-10 23:53:43.886300.2
2832023-06-10 23:59:58.98662842023-06-10 23:59:05.08653.9
\n", "

142 rows × 5 columns

\n", "
" ], "text/plain": [ " time steps change_flag time2 \\\n", "1 2023-06-10 00:18:46.986 44 2 2023-06-10 00:18:36.086 \n", "3 2023-06-10 00:55:00.586 44 4 2023-06-10 00:49:56.286 \n", "5 2023-06-10 01:08:58.786 44 6 2023-06-10 01:03:54.686 \n", "7 2023-06-10 01:24:09.886 44 8 2023-06-10 01:11:08.686 \n", "9 2023-06-10 01:45:54.386 44 10 2023-06-10 01:45:52.486 \n", ".. ... ... ... ... \n", "275 2023-06-10 23:42:35.686 44 276 2023-06-10 23:37:35.386 \n", "277 2023-06-10 23:47:57.686 44 278 2023-06-10 23:42:57.886 \n", "279 2023-06-10 23:53:16.886 44 280 2023-06-10 23:48:16.686 \n", "281 2023-06-10 23:58:44.086 44 282 2023-06-10 23:53:43.886 \n", "283 2023-06-10 23:59:58.986 6 284 2023-06-10 23:59:05.086 \n", "\n", " time_delta \n", "1 10.9 \n", "3 304.3 \n", "5 304.1 \n", "7 781.2 \n", "9 1.9 \n", ".. ... \n", "275 300.3 \n", "277 299.8 \n", "279 300.2 \n", "281 300.2 \n", "283 53.9 \n", "\n", "[142 rows x 5 columns]" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "change_time_group" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [], "source": [ "##增加是否超时的标识" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [], "source": [ "change_time_group['timeout']=0" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/2888816097.py:1: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " change_time_group['timeout'][change_time_group['time_delta']>310]=1\n" ] } ], "source": [ "change_time_group['timeout'][change_time_group['time_delta']>310]=1" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timestepschange_flagtime2time_deltatimeout
12023-06-10 00:18:46.9864422023-06-10 00:18:36.08610.90
32023-06-10 00:55:00.5864442023-06-10 00:49:56.286304.30
52023-06-10 01:08:58.7864462023-06-10 01:03:54.686304.10
72023-06-10 01:24:09.8864482023-06-10 01:11:08.686781.21
92023-06-10 01:45:54.38644102023-06-10 01:45:52.4861.90
.....................
2752023-06-10 23:42:35.686442762023-06-10 23:37:35.386300.30
2772023-06-10 23:47:57.686442782023-06-10 23:42:57.886299.80
2792023-06-10 23:53:16.886442802023-06-10 23:48:16.686300.20
2812023-06-10 23:58:44.086442822023-06-10 23:53:43.886300.20
2832023-06-10 23:59:58.98662842023-06-10 23:59:05.08653.90
\n", "

142 rows × 6 columns

\n", "
" ], "text/plain": [ " time steps change_flag time2 \\\n", "1 2023-06-10 00:18:46.986 44 2 2023-06-10 00:18:36.086 \n", "3 2023-06-10 00:55:00.586 44 4 2023-06-10 00:49:56.286 \n", "5 2023-06-10 01:08:58.786 44 6 2023-06-10 01:03:54.686 \n", "7 2023-06-10 01:24:09.886 44 8 2023-06-10 01:11:08.686 \n", "9 2023-06-10 01:45:54.386 44 10 2023-06-10 01:45:52.486 \n", ".. ... ... ... ... \n", "275 2023-06-10 23:42:35.686 44 276 2023-06-10 23:37:35.386 \n", "277 2023-06-10 23:47:57.686 44 278 2023-06-10 23:42:57.886 \n", "279 2023-06-10 23:53:16.886 44 280 2023-06-10 23:48:16.686 \n", "281 2023-06-10 23:58:44.086 44 282 2023-06-10 23:53:43.886 \n", "283 2023-06-10 23:59:58.986 6 284 2023-06-10 23:59:05.086 \n", "\n", " time_delta timeout \n", "1 10.9 0 \n", "3 304.3 0 \n", "5 304.1 0 \n", "7 781.2 1 \n", "9 1.9 0 \n", ".. ... ... \n", "275 300.3 0 \n", "277 299.8 0 \n", "279 300.2 0 \n", "281 300.2 0 \n", "283 53.9 0 \n", "\n", "[142 rows x 6 columns]" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "change_time_group" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [], "source": [ "##按照换电过程和换电步骤统计" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [], "source": [ "change_steps_time=data_in.groupby([\"change_flag\",\"steps\"]).apply(lambda x: pd.concat([x.head(1), x.tail(1)]))" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [], "source": [ "change_time_steps=change_steps_time.reset_index(drop=True)" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [], "source": [ "change_time_steps[\"time2\"]=change_time_steps[\"time\"].shift(1)" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [], "source": [ "time_group_steps=change_time_steps.groupby(['change_flag','steps']).tail(1)" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/2745163444.py:1: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " time_group_steps[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(time_group_steps[\"time\"])-pd.to_datetime(time_group_steps[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "time_group_steps[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(time_group_steps[\"time\"])-pd.to_datetime(time_group_steps[\"time2\"])).dt.total_seconds()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "time_group_steps.head()" ] }, { "cell_type": "code", "execution_count": 49, "metadata": {}, "outputs": [], "source": [ "##后面换电过程和分步骤的以这个为基础表" ] }, { "cell_type": "code", "execution_count": 50, "metadata": {}, "outputs": [], "source": [ "##统计有暂停的过程和步骤" ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, "outputs": [], "source": [ "data_pause=data_in[[\"change_flag\",\"steps\"]][data_in[\"pause\"]==1]" ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [], "source": [ "pause_result = data_pause.drop_duplicates(['change_flag', 'steps'])" ] }, { "cell_type": "code", "execution_count": 54, "metadata": {}, "outputs": [], "source": [ "##获取步骤的列表" ] }, { "cell_type": "code", "execution_count": 55, "metadata": {}, "outputs": [], "source": [ "pause_result_l=pause_result.groupby('change_flag')['steps'].apply(list).reset_index()" ] }, { "cell_type": "code", "execution_count": 56, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagsteps
08[6]
120[19]
222[43]
3150[30, 37]
\n", "
" ], "text/plain": [ " change_flag steps\n", "0 8 [6]\n", "1 20 [19]\n", "2 22 [43]\n", "3 150 [30, 37]" ] }, "execution_count": 56, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pause_result_l" ] }, { "cell_type": "code", "execution_count": 57, "metadata": {}, "outputs": [], "source": [ "pause_result_l.columns=[\"change_flag\",\"pause_steps\"]" ] }, { "cell_type": "code", "execution_count": 58, "metadata": {}, "outputs": [], "source": [ "pause_result_group=pause_result.groupby('change_flag').count()" ] }, { "cell_type": "code", "execution_count": 59, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
steps
change_flag
81
201
221
1502
\n", "
" ], "text/plain": [ " steps\n", "change_flag \n", "8 1\n", "20 1\n", "22 1\n", "150 2" ] }, "execution_count": 59, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pause_result_group" ] }, { "cell_type": "code", "execution_count": 60, "metadata": {}, "outputs": [], "source": [ "pause_result_group=pause_result_group.reset_index()" ] }, { "cell_type": "code", "execution_count": 61, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagsteps
081
1201
2221
31502
\n", "
" ], "text/plain": [ " change_flag steps\n", "0 8 1\n", "1 20 1\n", "2 22 1\n", "3 150 2" ] }, "execution_count": 61, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pause_result_group" ] }, { "cell_type": "code", "execution_count": 62, "metadata": {}, "outputs": [], "source": [ "pause_result_group.columns=[\"change_flag\",\"pause_steps_num\"]" ] }, { "cell_type": "code", "execution_count": 63, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagpause_steps_num
081
1201
2221
31502
\n", "
" ], "text/plain": [ " change_flag pause_steps_num\n", "0 8 1\n", "1 20 1\n", "2 22 1\n", "3 150 2" ] }, "execution_count": 63, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pause_result_group" ] }, { "cell_type": "code", "execution_count": 64, "metadata": {}, "outputs": [], "source": [ "##统计有急停的过程和步骤" ] }, { "cell_type": "code", "execution_count": 65, "metadata": {}, "outputs": [], "source": [ "data_stop=data_in[[\"change_flag\",\"steps\"]][data_in[\"emer_stop\"]==1]" ] }, { "cell_type": "code", "execution_count": 66, "metadata": {}, "outputs": [], "source": [ "stop_result = data_stop.drop_duplicates(['change_flag', 'steps'])" ] }, { "cell_type": "code", "execution_count": 67, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagsteps
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [change_flag, steps]\n", "Index: []" ] }, "execution_count": 67, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stop_result" ] }, { "cell_type": "code", "execution_count": 68, "metadata": {}, "outputs": [], "source": [ "stop_result_l=stop_result.groupby('change_flag')['steps'].apply(list).reset_index()" ] }, { "cell_type": "code", "execution_count": 69, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagsteps
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [change_flag, steps]\n", "Index: []" ] }, "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stop_result_l" ] }, { "cell_type": "code", "execution_count": 70, "metadata": {}, "outputs": [], "source": [ "stop_result_l.columns=[\"change_flag\",\"stop_steps\"]" ] }, { "cell_type": "code", "execution_count": 71, "metadata": {}, "outputs": [], "source": [ "stop_result_group=stop_result.groupby('change_flag').count()" ] }, { "cell_type": "code", "execution_count": 72, "metadata": {}, "outputs": [], "source": [ "stop_result_group=stop_result_group.reset_index()" ] }, { "cell_type": "code", "execution_count": 73, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagsteps
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [change_flag, steps]\n", "Index: []" ] }, "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stop_result_group" ] }, { "cell_type": "code", "execution_count": 74, "metadata": {}, "outputs": [], "source": [ "stop_result_group.columns=[\"change_flag\",\"stop_steps_num\"]" ] }, { "cell_type": "code", "execution_count": 75, "metadata": {}, "outputs": [], "source": [ "##统计有故障的过程和步骤" ] }, { "cell_type": "code", "execution_count": 76, "metadata": {}, "outputs": [], "source": [ "data_fault=data_in[[\"change_flag\",\"steps\"]][data_in[\"status\"]==4]" ] }, { "cell_type": "code", "execution_count": 77, "metadata": {}, "outputs": [], "source": [ "fault_result = data_fault.drop_duplicates(['change_flag', 'steps'])" ] }, { "cell_type": "code", "execution_count": 78, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagsteps
4315986
2991742019
62584615037
\n", "
" ], "text/plain": [ " change_flag steps\n", "43159 8 6\n", "299174 20 19\n", "625846 150 37" ] }, "execution_count": 78, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fault_result" ] }, { "cell_type": "code", "execution_count": 79, "metadata": {}, "outputs": [], "source": [ "error_code1=data_in[[\"change_flag\",\"steps\",\"error_code1\"]][(data_in[\"status\"]==4)&(data_in[\"error_code1\"]!=0)]\n", "error_code1.columns=[\"change_flag\",\"steps\",\"error_code\"]" ] }, { "cell_type": "code", "execution_count": 80, "metadata": {}, "outputs": [], "source": [ "error_code2=data_in[[\"change_flag\",\"steps\",\"error_code2\"]][(data_in[\"status\"]==4)&(data_in[\"error_code2\"]!=0)]\n", "error_code2.columns=[\"change_flag\",\"steps\",\"error_code\"]\n", "error_code3=data_in[[\"change_flag\",\"steps\",\"error_code3\"]][(data_in[\"status\"]==4)&(data_in[\"error_code3\"]!=0)]\n", "error_code3.columns=[\"change_flag\",\"steps\",\"error_code\"]\n", "error_code4=data_in[[\"change_flag\",\"steps\",\"error_code4\"]][(data_in[\"status\"]==4)&(data_in[\"error_code4\"]!=0)]\n", "error_code4.columns=[\"change_flag\",\"steps\",\"error_code\"]\n", "error_code5=data_in[[\"change_flag\",\"steps\",\"error_code5\"]][(data_in[\"status\"]==4)&(data_in[\"error_code5\"]!=0)]\n", "error_code5.columns=[\"change_flag\",\"steps\",\"error_code\"]\n", "error_code6=data_in[[\"change_flag\",\"steps\",\"error_code6\"]][(data_in[\"status\"]==4)&(data_in[\"error_code6\"]!=0)]\n", "error_code6.columns=[\"change_flag\",\"steps\",\"error_code\"]\n", "error_code7=data_in[[\"change_flag\",\"steps\",\"error_code7\"]][(data_in[\"status\"]==4)&(data_in[\"error_code7\"]!=0)]\n", "error_code7.columns=[\"change_flag\",\"steps\",\"error_code\"]\n", "error_code8=data_in[[\"change_flag\",\"steps\",\"error_code8\"]][(data_in[\"status\"]==4)&(data_in[\"error_code8\"]!=0)]\n", "error_code8.columns=[\"change_flag\",\"steps\",\"error_code\"]\n", "error_code9=data_in[[\"change_flag\",\"steps\",\"error_code9\"]][(data_in[\"status\"]==4)&(data_in[\"error_code9\"]!=0)]\n", "error_code9.columns=[\"change_flag\",\"steps\",\"error_code\"]\n", "error_code10=data_in[[\"change_flag\",\"steps\",\"error_code10\"]][(data_in[\"status\"]==4)&(data_in[\"error_code10\"]!=0)]\n", "error_code10.columns=[\"change_flag\",\"steps\",\"error_code\"]" ] }, { "cell_type": "code", "execution_count": 81, "metadata": {}, "outputs": [], "source": [ "error_code=pd.concat([error_code1,error_code2,error_code3,error_code4,error_code5,error_code6,error_code7,error_code8,error_code9,error_code10])" ] }, { "cell_type": "code", "execution_count": 83, "metadata": {}, "outputs": [], "source": [ "error_code[\"error_code\"]=error_code[\"error_code\"].astype('int')" ] }, { "cell_type": "code", "execution_count": 85, "metadata": {}, "outputs": [], "source": [ "error_code = error_code.drop_duplicates(['change_flag', 'steps','error_code'])" ] }, { "cell_type": "code", "execution_count": 86, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagstepserror_code
6258751503716912
6258461503712816
43159867011
29917420197006
625846150377000
\n", "
" ], "text/plain": [ " change_flag steps error_code\n", "625875 150 37 16912\n", "625846 150 37 12816\n", "43159 8 6 7011\n", "299174 20 19 7006\n", "625846 150 37 7000" ] }, "execution_count": 86, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_code" ] }, { "cell_type": "code", "execution_count": 87, "metadata": {}, "outputs": [], "source": [ "error_code=error_code[error_code[\"error_code\"]!=7000]" ] }, { "cell_type": "code", "execution_count": 88, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagstepserror_code
6258751503716912
6258461503712816
43159867011
29917420197006
\n", "
" ], "text/plain": [ " change_flag steps error_code\n", "625875 150 37 16912\n", "625846 150 37 12816\n", "43159 8 6 7011\n", "299174 20 19 7006" ] }, "execution_count": 88, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_code" ] }, { "cell_type": "code", "execution_count": 231, "metadata": {}, "outputs": [], "source": [ "error_code=error_code.groupby(['change_flag','steps'])['error_code'].apply(list).reset_index()" ] }, { "cell_type": "code", "execution_count": 232, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagstepserror_code
086[7011]
12019[7006]
215037[16912, 12816]
\n", "
" ], "text/plain": [ " change_flag steps error_code\n", "0 8 6 [7011]\n", "1 20 19 [7006]\n", "2 150 37 [16912, 12816]" ] }, "execution_count": 232, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_code" ] }, { "cell_type": "code", "execution_count": 89, "metadata": {}, "outputs": [], "source": [ "##后面换电过程和分步骤按这个关联" ] }, { "cell_type": "code", "execution_count": 90, "metadata": {}, "outputs": [], "source": [ "fault_result_l=fault_result.groupby('change_flag')['steps'].apply(list).reset_index()" ] }, { "cell_type": "code", "execution_count": 91, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagsteps
08[6]
120[19]
2150[37]
\n", "
" ], "text/plain": [ " change_flag steps\n", "0 8 [6]\n", "1 20 [19]\n", "2 150 [37]" ] }, "execution_count": 91, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fault_result_l" ] }, { "cell_type": "code", "execution_count": 92, "metadata": {}, "outputs": [], "source": [ "fault_result_l.columns=[\"change_flag\",\"fault_steps\"]" ] }, { "cell_type": "code", "execution_count": 97, "metadata": {}, "outputs": [], "source": [ "error_code_group=error_code[[\"change_flag\",\"error_code\"]].drop_duplicates(['change_flag', 'error_code'])" ] }, { "cell_type": "code", "execution_count": 98, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagerror_code
62587515016912
62584615012816
4315987011
299174207006
\n", "
" ], "text/plain": [ " change_flag error_code\n", "625875 150 16912\n", "625846 150 12816\n", "43159 8 7011\n", "299174 20 7006" ] }, "execution_count": 98, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_code_group" ] }, { "cell_type": "code", "execution_count": 99, "metadata": {}, "outputs": [], "source": [ "error_code_group_l=error_code_group.groupby('change_flag')['error_code'].apply(list).reset_index()" ] }, { "cell_type": "code", "execution_count": 100, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagerror_code
08[7011]
120[7006]
2150[16912, 12816]
\n", "
" ], "text/plain": [ " change_flag error_code\n", "0 8 [7011]\n", "1 20 [7006]\n", "2 150 [16912, 12816]" ] }, "execution_count": 100, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_code_group_l" ] }, { "cell_type": "code", "execution_count": 101, "metadata": {}, "outputs": [], "source": [ "error_code_group_l.columns=[\"change_flag\",\"error_code\"]" ] }, { "cell_type": "code", "execution_count": 102, "metadata": {}, "outputs": [], "source": [ "fault_result_group=fault_result.groupby('change_flag').count()" ] }, { "cell_type": "code", "execution_count": 103, "metadata": {}, "outputs": [], "source": [ "fault_result_group=fault_result_group.reset_index()" ] }, { "cell_type": "code", "execution_count": 104, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagsteps
081
1201
21501
\n", "
" ], "text/plain": [ " change_flag steps\n", "0 8 1\n", "1 20 1\n", "2 150 1" ] }, "execution_count": 104, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fault_result_group" ] }, { "cell_type": "code", "execution_count": 105, "metadata": {}, "outputs": [], "source": [ "fault_result_group.columns=[\"change_flag\",\"fault_steps_num\"]" ] }, { "cell_type": "code", "execution_count": 106, "metadata": {}, "outputs": [], "source": [ "####基于换电过程的指标汇总加工" ] }, { "cell_type": "code", "execution_count": 107, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timestepschange_flagtime2time_deltatimeout
12023-06-10 00:18:46.9864422023-06-10 00:18:36.08610.90
32023-06-10 00:55:00.5864442023-06-10 00:49:56.286304.30
52023-06-10 01:08:58.7864462023-06-10 01:03:54.686304.10
72023-06-10 01:24:09.8864482023-06-10 01:11:08.686781.21
92023-06-10 01:45:54.38644102023-06-10 01:45:52.4861.90
\n", "
" ], "text/plain": [ " time steps change_flag time2 \\\n", "1 2023-06-10 00:18:46.986 44 2 2023-06-10 00:18:36.086 \n", "3 2023-06-10 00:55:00.586 44 4 2023-06-10 00:49:56.286 \n", "5 2023-06-10 01:08:58.786 44 6 2023-06-10 01:03:54.686 \n", "7 2023-06-10 01:24:09.886 44 8 2023-06-10 01:11:08.686 \n", "9 2023-06-10 01:45:54.386 44 10 2023-06-10 01:45:52.486 \n", "\n", " time_delta timeout \n", "1 10.9 0 \n", "3 304.3 0 \n", "5 304.1 0 \n", "7 781.2 1 \n", "9 1.9 0 " ] }, "execution_count": 107, "metadata": {}, "output_type": "execute_result" } ], "source": [ "###换电过程的基表\n", "change_time_group.head()" ] }, { "cell_type": "code", "execution_count": 108, "metadata": {}, "outputs": [], "source": [ "change_time_group=change_time_group[[\"time2\",\"time\",\"time_delta\",\"timeout\",\"change_flag\"]]" ] }, { "cell_type": "code", "execution_count": 109, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
time2timetime_deltatimeoutchange_flag
12023-06-10 00:18:36.0862023-06-10 00:18:46.98610.902
32023-06-10 00:49:56.2862023-06-10 00:55:00.586304.304
52023-06-10 01:03:54.6862023-06-10 01:08:58.786304.106
72023-06-10 01:11:08.6862023-06-10 01:24:09.886781.218
92023-06-10 01:45:52.4862023-06-10 01:45:54.3861.9010
..................
2752023-06-10 23:37:35.3862023-06-10 23:42:35.686300.30276
2772023-06-10 23:42:57.8862023-06-10 23:47:57.686299.80278
2792023-06-10 23:48:16.6862023-06-10 23:53:16.886300.20280
2812023-06-10 23:53:43.8862023-06-10 23:58:44.086300.20282
2832023-06-10 23:59:05.0862023-06-10 23:59:58.98653.90284
\n", "

142 rows × 5 columns

\n", "
" ], "text/plain": [ " time2 time time_delta timeout \\\n", "1 2023-06-10 00:18:36.086 2023-06-10 00:18:46.986 10.9 0 \n", "3 2023-06-10 00:49:56.286 2023-06-10 00:55:00.586 304.3 0 \n", "5 2023-06-10 01:03:54.686 2023-06-10 01:08:58.786 304.1 0 \n", "7 2023-06-10 01:11:08.686 2023-06-10 01:24:09.886 781.2 1 \n", "9 2023-06-10 01:45:52.486 2023-06-10 01:45:54.386 1.9 0 \n", ".. ... ... ... ... \n", "275 2023-06-10 23:37:35.386 2023-06-10 23:42:35.686 300.3 0 \n", "277 2023-06-10 23:42:57.886 2023-06-10 23:47:57.686 299.8 0 \n", "279 2023-06-10 23:48:16.686 2023-06-10 23:53:16.886 300.2 0 \n", "281 2023-06-10 23:53:43.886 2023-06-10 23:58:44.086 300.2 0 \n", "283 2023-06-10 23:59:05.086 2023-06-10 23:59:58.986 53.9 0 \n", "\n", " change_flag \n", "1 2 \n", "3 4 \n", "5 6 \n", "7 8 \n", "9 10 \n", ".. ... \n", "275 276 \n", "277 278 \n", "279 280 \n", "281 282 \n", "283 284 \n", "\n", "[142 rows x 5 columns]" ] }, "execution_count": 109, "metadata": {}, "output_type": "execute_result" } ], "source": [ "change_time_group" ] }, { "cell_type": "code", "execution_count": 110, "metadata": {}, "outputs": [], "source": [ "change_time_group.columns=[\"c_time_b\",\"c_time_e\",\"c_time_delta\",\"c_time_out\",\"change_flag\"]" ] }, { "cell_type": "code", "execution_count": 111, "metadata": {}, "outputs": [], "source": [ "###关联换电步骤数和换电步骤是否完整" ] }, { "cell_type": "code", "execution_count": 112, "metadata": {}, "outputs": [], "source": [ "group_base=pd.merge(change_time_group,change_steps,on='change_flag',how='left')" ] }, { "cell_type": "code", "execution_count": 113, "metadata": {}, "outputs": [], "source": [ "group_base.rename(columns={'steps': 'steps_num'}, inplace=True)" ] }, { "cell_type": "code", "execution_count": 114, "metadata": {}, "outputs": [], "source": [ "###基于换电过程基本关联暂停、急停、故障等" ] }, { "cell_type": "code", "execution_count": 115, "metadata": {}, "outputs": [], "source": [ "##关联暂停的信息" ] }, { "cell_type": "code", "execution_count": 116, "metadata": {}, "outputs": [], "source": [ "group_base=pd.merge(group_base,pause_result_l,on='change_flag',how='left')" ] }, { "cell_type": "code", "execution_count": 117, "metadata": {}, "outputs": [], "source": [ "group_base=pd.merge(group_base,pause_result_group,on='change_flag',how='left')" ] }, { "cell_type": "code", "execution_count": 118, "metadata": {}, "outputs": [], "source": [ "##关联急停信息" ] }, { "cell_type": "code", "execution_count": 119, "metadata": {}, "outputs": [], "source": [ "group_base=pd.merge(group_base,stop_result_l,on='change_flag',how='left')" ] }, { "cell_type": "code", "execution_count": 120, "metadata": {}, "outputs": [], "source": [ "group_base=pd.merge(group_base,stop_result_group,on='change_flag',how='left')" ] }, { "cell_type": "code", "execution_count": 121, "metadata": {}, "outputs": [], "source": [ "##关联故障信息error_code_group_l" ] }, { "cell_type": "code", "execution_count": 122, "metadata": {}, "outputs": [], "source": [ "group_base=pd.merge(group_base,fault_result_l,on='change_flag',how='left')" ] }, { "cell_type": "code", "execution_count": 123, "metadata": {}, "outputs": [], "source": [ "group_base=pd.merge(group_base,error_code_group_l,on='change_flag',how='left')" ] }, { "cell_type": "code", "execution_count": 124, "metadata": {}, "outputs": [], "source": [ "group_base=pd.merge(group_base,fault_result_group,on='change_flag',how='left')" ] }, { "cell_type": "code", "execution_count": 125, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
c_time_bc_time_ec_time_deltac_time_outchange_flagsteps_numfull_stepspause_stepspause_steps_numstop_stepsstop_steps_numfault_stepserror_codefault_steps_num
02023-06-10 00:18:36.0862023-06-10 00:18:46.98610.90210NaNNaNNaNNaNNaNNaNNaN
12023-06-10 00:49:56.2862023-06-10 00:55:00.586304.304441NaNNaNNaNNaNNaNNaNNaN
22023-06-10 01:03:54.6862023-06-10 01:08:58.786304.106441NaNNaNNaNNaNNaNNaNNaN
32023-06-10 01:11:08.6862023-06-10 01:24:09.886781.218441[6]1.0NaNNaN[6][7011]1.0
42023-06-10 01:45:52.4862023-06-10 01:45:54.3861.901020NaNNaNNaNNaNNaNNaNNaN
.............................................
1372023-06-10 23:37:35.3862023-06-10 23:42:35.686300.30276441NaNNaNNaNNaNNaNNaNNaN
1382023-06-10 23:42:57.8862023-06-10 23:47:57.686299.80278441NaNNaNNaNNaNNaNNaNNaN
1392023-06-10 23:48:16.6862023-06-10 23:53:16.886300.20280441NaNNaNNaNNaNNaNNaNNaN
1402023-06-10 23:53:43.8862023-06-10 23:58:44.086300.20282441NaNNaNNaNNaNNaNNaNNaN
1412023-06-10 23:59:05.0862023-06-10 23:59:58.98653.9028460NaNNaNNaNNaNNaNNaNNaN
\n", "

142 rows × 14 columns

\n", "
" ], "text/plain": [ " c_time_b c_time_e c_time_delta \\\n", "0 2023-06-10 00:18:36.086 2023-06-10 00:18:46.986 10.9 \n", "1 2023-06-10 00:49:56.286 2023-06-10 00:55:00.586 304.3 \n", "2 2023-06-10 01:03:54.686 2023-06-10 01:08:58.786 304.1 \n", "3 2023-06-10 01:11:08.686 2023-06-10 01:24:09.886 781.2 \n", "4 2023-06-10 01:45:52.486 2023-06-10 01:45:54.386 1.9 \n", ".. ... ... ... \n", "137 2023-06-10 23:37:35.386 2023-06-10 23:42:35.686 300.3 \n", "138 2023-06-10 23:42:57.886 2023-06-10 23:47:57.686 299.8 \n", "139 2023-06-10 23:48:16.686 2023-06-10 23:53:16.886 300.2 \n", "140 2023-06-10 23:53:43.886 2023-06-10 23:58:44.086 300.2 \n", "141 2023-06-10 23:59:05.086 2023-06-10 23:59:58.986 53.9 \n", "\n", " c_time_out change_flag steps_num full_steps pause_steps \\\n", "0 0 2 1 0 NaN \n", "1 0 4 44 1 NaN \n", "2 0 6 44 1 NaN \n", "3 1 8 44 1 [6] \n", "4 0 10 2 0 NaN \n", ".. ... ... ... ... ... \n", "137 0 276 44 1 NaN \n", "138 0 278 44 1 NaN \n", "139 0 280 44 1 NaN \n", "140 0 282 44 1 NaN \n", "141 0 284 6 0 NaN \n", "\n", " pause_steps_num stop_steps stop_steps_num fault_steps error_code \\\n", "0 NaN NaN NaN NaN NaN \n", "1 NaN NaN NaN NaN NaN \n", "2 NaN NaN NaN NaN NaN \n", "3 1.0 NaN NaN [6] [7011] \n", "4 NaN NaN NaN NaN NaN \n", ".. ... ... ... ... ... \n", "137 NaN NaN NaN NaN NaN \n", "138 NaN NaN NaN NaN NaN \n", "139 NaN NaN NaN NaN NaN \n", "140 NaN NaN NaN NaN NaN \n", "141 NaN NaN NaN NaN NaN \n", "\n", " fault_steps_num \n", "0 NaN \n", "1 NaN \n", "2 NaN \n", "3 1.0 \n", "4 NaN \n", ".. ... \n", "137 NaN \n", "138 NaN \n", "139 NaN \n", "140 NaN \n", "141 NaN \n", "\n", "[142 rows x 14 columns]" ] }, "execution_count": 125, "metadata": {}, "output_type": "execute_result" } ], "source": [ "group_base" ] }, { "cell_type": "code", "execution_count": 126, "metadata": {}, "outputs": [], "source": [ "group_base.to_csv(\"group_base_10.csv\",index=False)" ] }, { "cell_type": "code", "execution_count": 127, "metadata": {}, "outputs": [], "source": [ "##有问题的步骤数和步骤列表" ] }, { "cell_type": "code", "execution_count": 128, "metadata": {}, "outputs": [], "source": [ "##按照换电过程和步骤加工其他指标" ] }, { "cell_type": "code", "execution_count": 129, "metadata": {}, "outputs": [], "source": [ "##4个转锁的分析,转锁相关的步骤" ] }, { "cell_type": "code", "execution_count": 130, "metadata": {}, "outputs": [], "source": [ "##第5步,转锁伸出,一共4个转锁,加工反应时间和运动时间" ] }, { "cell_type": "code", "execution_count": 131, "metadata": {}, "outputs": [], "source": [ "##取数[4,5,6]" ] }, { "cell_type": "code", "execution_count": 132, "metadata": {}, "outputs": [], "source": [ "block_step_5=[4,5,6]" ] }, { "cell_type": "code", "execution_count": 133, "metadata": {}, "outputs": [], "source": [ "data_step_5=data_in[data_in[\"steps\"].isin(block_step_5)]" ] }, { "cell_type": "code", "execution_count": 134, "metadata": {}, "outputs": [], "source": [ "data_step_5_block1=data_step_5[[\"time\",\"change_flag\",\"steps\",\"lock1_retracted\",\"lock1_extended\"]]\n", "data_step_5_block2=data_step_5[[\"time\",\"change_flag\",\"steps\",\"lock2_retracted\",\"lock2_extended\"]]\n", "data_step_5_block3=data_step_5[[\"time\",\"change_flag\",\"steps\",\"lock3_retracted\",\"lock3_extended\"]]\n", "data_step_5_block4=data_step_5[[\"time\",\"change_flag\",\"steps\",\"lock4_retracted\",\"lock4_extended\"]]" ] }, { "cell_type": "code", "execution_count": 135, "metadata": {}, "outputs": [], "source": [ "###构建一个函数" ] }, { "cell_type": "code", "execution_count": 136, "metadata": {}, "outputs": [], "source": [ "###修订增加函数参数" ] }, { "cell_type": "code", "execution_count": 137, "metadata": {}, "outputs": [], "source": [ "def block_extend_time(data_step_block,upd=4,cored=5,downd=6):\n", " data_step_block.columns=[\"time\",\"change_flag\",\"steps\",\"lock_retracted\",\"lock_extended\"]\n", " exchange_process_list=list(set(data_step_block[\"change_flag\"]))\n", " union_t=pd.DataFrame()\n", " result_f=pd.DataFrame()\n", " result_r=pd.DataFrame()\n", " for change_flag in exchange_process_list:\n", " step_up_last=data_step_block[(data_step_block[\"change_flag\"]==change_flag)&(data_step_block[\"steps\"]==upd)].tail(1)\n", " step_core=data_step_block[(data_step_block[\"change_flag\"]==change_flag)&(data_step_block[\"steps\"]==cored)]\n", " step_down_first=data_step_block[(data_step_block[\"change_flag\"]==change_flag)&(data_step_block[\"steps\"]==downd)]\n", " fulld=pd.concat([step_up_last,step_core,step_down_first],axis=0,ignore_index=True)\n", " act_first=fulld[fulld[\"lock_retracted\"]==1].tail(1)\n", " act_last=fulld[fulld[\"lock_extended\"]==1].head(1)\n", " union=pd.concat([step_up_last,act_first,act_last],axis=0,ignore_index=True)\n", " union_t=pd.concat([union_t,union],axis=0,ignore_index=True)\n", " \n", " union_t[\"time2\"]=union_t[\"time\"].shift(1)\n", " result=union_t.groupby('change_flag').tail(2)\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds() \n", "\n", " result_f =result.groupby('change_flag').head(1)\n", " result_f=result_f[['change_flag','steps','time_delta']]\n", " result_f.columns=['change_flag','steps','block_f_time']\n", " result_f[\"steps\"]=cored\n", " result_r =result.groupby('change_flag').tail(1)\n", " result_r=result_r[['change_flag','steps','time_delta']]\n", " result_r.columns=['change_flag','steps','block_r_time']\n", " result_r[\"steps\"]=cored\n", " \n", " return result_f,result_r" ] }, { "cell_type": "code", "execution_count": 138, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/1869633404.py:19: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "result_f51,result_r51=block_extend_time(data_step_5_block1)\n", "result_f52,result_r52=block_extend_time(data_step_5_block2)\n", "result_f53,result_r53=block_extend_time(data_step_5_block3)\n", "result_f54,result_r54=block_extend_time(data_step_5_block4)" ] }, { "cell_type": "code", "execution_count": 139, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagstepsblock_r_time
2450.6
5650.5
8850.5
112050.6
142850.6
............
38327650.5
38627850.6
38928050.6
39228250.5
39528450.6
\n", "

132 rows × 3 columns

\n", "
" ], "text/plain": [ " change_flag steps block_r_time\n", "2 4 5 0.6\n", "5 6 5 0.5\n", "8 8 5 0.5\n", "11 20 5 0.6\n", "14 28 5 0.6\n", ".. ... ... ...\n", "383 276 5 0.5\n", "386 278 5 0.6\n", "389 280 5 0.6\n", "392 282 5 0.5\n", "395 284 5 0.6\n", "\n", "[132 rows x 3 columns]" ] }, "execution_count": 139, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result_r54" ] }, { "cell_type": "code", "execution_count": 140, "metadata": {}, "outputs": [], "source": [ "##13步解锁" ] }, { "cell_type": "code", "execution_count": 141, "metadata": {}, "outputs": [], "source": [ "block_step_13=[12,13,14]" ] }, { "cell_type": "code", "execution_count": 142, "metadata": {}, "outputs": [], "source": [ "data_step_13=data_in[data_in[\"steps\"].isin(block_step_13)]" ] }, { "cell_type": "code", "execution_count": 143, "metadata": {}, "outputs": [], "source": [ "data_step_13_block1=data_step_13[[\"time\",\"change_flag\",\"steps\",\"lock1_retracted\",\"lock1_extended\"]]\n", "data_step_13_block2=data_step_13[[\"time\",\"change_flag\",\"steps\",\"lock2_retracted\",\"lock2_extended\"]]\n", "data_step_13_block3=data_step_13[[\"time\",\"change_flag\",\"steps\",\"lock3_retracted\",\"lock3_extended\"]]\n", "data_step_13_block4=data_step_13[[\"time\",\"change_flag\",\"steps\",\"lock4_retracted\",\"lock4_extended\"]]" ] }, { "cell_type": "code", "execution_count": 144, "metadata": {}, "outputs": [], "source": [ "###构建一个转锁收回函数" ] }, { "cell_type": "code", "execution_count": 145, "metadata": {}, "outputs": [], "source": [ "def block_retracted_time(data_step_block,upd=12,cored=13,downd=14):\n", " data_step_block.columns=[\"time\",\"change_flag\",\"steps\",\"lock_retracted\",\"lock_extended\"]\n", " exchange_process_list=list(set(data_step_block[\"change_flag\"]))\n", " union_t=pd.DataFrame()\n", " result_f=pd.DataFrame()\n", " result_r=pd.DataFrame()\n", " \n", " for change_flag in exchange_process_list:\n", " step_up_last=data_step_block[(data_step_block[\"change_flag\"]==change_flag)&(data_step_block[\"steps\"]==upd)].tail(1)\n", " step_core=data_step_block[(data_step_block[\"change_flag\"]==change_flag)&(data_step_block[\"steps\"]==cored)]\n", " step_down_first=data_step_block[(data_step_block[\"change_flag\"]==change_flag)&(data_step_block[\"steps\"]==downd)]\n", " fulld=pd.concat([step_up_last,step_core,step_down_first],axis=0,ignore_index=True)\n", " act_first=fulld[fulld[\"lock_extended\"]==1].tail(1)\n", " act_last=fulld[fulld[\"lock_retracted\"]==1].head(1)\n", " union=pd.concat([step_up_last,act_first,act_last],axis=0,ignore_index=True)\n", " union_t=pd.concat([union_t,union],axis=0,ignore_index=True)\n", " \n", " union_t[\"time2\"]=union_t[\"time\"].shift(1)\n", " result=union_t.groupby('change_flag').tail(2)\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds() \n", "\n", " result_f =result.groupby('change_flag').head(1)\n", " result_f=result_f[['change_flag','steps','time_delta']]\n", " result_f.columns=['change_flag','steps','block_f_time']\n", " result_f[\"steps\"]=cored\n", " result_r =result.groupby('change_flag').tail(1)\n", " result_r=result_r[['change_flag','steps','time_delta']]\n", " result_r.columns=['change_flag','steps','block_r_time']\n", " result_r[\"steps\"]=cored\n", " \n", " return result_f,result_r" ] }, { "cell_type": "code", "execution_count": 146, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/3010289667.py:20: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "result_f131,result_r131=block_retracted_time(data_step_13_block1)\n", "result_f132,result_r132=block_retracted_time(data_step_13_block2)\n", "result_f133,result_r133=block_retracted_time(data_step_13_block3)\n", "result_f134,result_r134=block_retracted_time(data_step_13_block4)" ] }, { "cell_type": "code", "execution_count": 147, "metadata": {}, "outputs": [], "source": [ "##19步上锁,27解锁,33 上锁 ,41解锁" ] }, { "cell_type": "code", "execution_count": 148, "metadata": {}, "outputs": [], "source": [ "##19步上锁" ] }, { "cell_type": "code", "execution_count": 149, "metadata": {}, "outputs": [], "source": [ "block_step_19=[18,19,20]" ] }, { "cell_type": "code", "execution_count": 150, "metadata": {}, "outputs": [], "source": [ "data_step_19=data_in[data_in[\"steps\"].isin(block_step_19)]" ] }, { "cell_type": "code", "execution_count": 151, "metadata": {}, "outputs": [], "source": [ "data_step_19_block1=data_step_19[[\"time\",\"change_flag\",\"steps\",\"lock1_retracted\",\"lock1_extended\"]]\n", "data_step_19_block2=data_step_19[[\"time\",\"change_flag\",\"steps\",\"lock2_retracted\",\"lock2_extended\"]]\n", "data_step_19_block3=data_step_19[[\"time\",\"change_flag\",\"steps\",\"lock3_retracted\",\"lock3_extended\"]]\n", "data_step_19_block4=data_step_19[[\"time\",\"change_flag\",\"steps\",\"lock4_retracted\",\"lock4_extended\"]]" ] }, { "cell_type": "code", "execution_count": 152, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/1869633404.py:19: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "result_f191,result_r191=block_extend_time(data_step_19_block1,upd=18,cored=19,downd=20)\n", "result_f192,result_r192=block_extend_time(data_step_19_block2,upd=18,cored=19,downd=20)\n", "result_f193,result_r193=block_extend_time(data_step_19_block3,upd=18,cored=19,downd=20)\n", "result_f194,result_r194=block_extend_time(data_step_19_block4,upd=18,cored=19,downd=20)" ] }, { "cell_type": "code", "execution_count": 153, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/3010289667.py:20: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "block_step_27=[26,27,28]\n", "data_step_27=data_in[data_in[\"steps\"].isin(block_step_27)]\n", "data_step_27_block1=data_step_27[[\"time\",\"change_flag\",\"steps\",\"lock1_retracted\",\"lock1_extended\"]]\n", "data_step_27_block2=data_step_27[[\"time\",\"change_flag\",\"steps\",\"lock2_retracted\",\"lock2_extended\"]]\n", "data_step_27_block3=data_step_27[[\"time\",\"change_flag\",\"steps\",\"lock3_retracted\",\"lock3_extended\"]]\n", "data_step_27_block4=data_step_27[[\"time\",\"change_flag\",\"steps\",\"lock4_retracted\",\"lock4_extended\"]]\n", "result_f271,result_r271=block_retracted_time(data_step_27_block1,upd=26,cored=27,downd=28)\n", "result_f272,result_r272=block_retracted_time(data_step_27_block2,upd=26,cored=27,downd=28)\n", "result_f273,result_r273=block_retracted_time(data_step_27_block3,upd=26,cored=27,downd=28)\n", "result_f274,result_r274=block_retracted_time(data_step_27_block4,upd=26,cored=27,downd=28)" ] }, { "cell_type": "code", "execution_count": 154, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/1869633404.py:19: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "block_step_33=[32,33,34]\n", "data_step_33=data_in[data_in[\"steps\"].isin(block_step_33)]\n", "data_step_33_block1=data_step_33[[\"time\",\"change_flag\",\"steps\",\"lock1_retracted\",\"lock1_extended\"]]\n", "data_step_33_block2=data_step_33[[\"time\",\"change_flag\",\"steps\",\"lock2_retracted\",\"lock2_extended\"]]\n", "data_step_33_block3=data_step_33[[\"time\",\"change_flag\",\"steps\",\"lock3_retracted\",\"lock3_extended\"]]\n", "data_step_33_block4=data_step_33[[\"time\",\"change_flag\",\"steps\",\"lock4_retracted\",\"lock4_extended\"]]\n", "result_f331,result_r331=block_extend_time(data_step_33_block1,upd=32,cored=33,downd=34)\n", "result_f332,result_r332=block_extend_time(data_step_33_block2,upd=32,cored=33,downd=34)\n", "result_f333,result_r333=block_extend_time(data_step_33_block3,upd=32,cored=33,downd=34)\n", "result_f334,result_r334=block_extend_time(data_step_33_block4,upd=32,cored=33,downd=34)" ] }, { "cell_type": "code", "execution_count": 155, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/3010289667.py:20: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "block_step_41=[40,41,42]\n", "data_step_41=data_in[data_in[\"steps\"].isin(block_step_41)]\n", "data_step_41_block1=data_step_41[[\"time\",\"change_flag\",\"steps\",\"lock1_retracted\",\"lock1_extended\"]]\n", "data_step_41_block2=data_step_41[[\"time\",\"change_flag\",\"steps\",\"lock2_retracted\",\"lock2_extended\"]]\n", "data_step_41_block3=data_step_41[[\"time\",\"change_flag\",\"steps\",\"lock3_retracted\",\"lock3_extended\"]]\n", "data_step_41_block4=data_step_41[[\"time\",\"change_flag\",\"steps\",\"lock4_retracted\",\"lock4_extended\"]]\n", "result_f411,result_r411=block_retracted_time(data_step_41_block1,upd=40,cored=41,downd=42)\n", "result_f412,result_r412=block_retracted_time(data_step_41_block2,upd=40,cored=41,downd=42)\n", "result_f413,result_r413=block_retracted_time(data_step_41_block3,upd=40,cored=41,downd=42)\n", "result_f414,result_r414=block_retracted_time(data_step_41_block4,upd=40,cored=41,downd=42)" ] }, { "cell_type": "code", "execution_count": 156, "metadata": {}, "outputs": [], "source": [ "###推杆的指标,共两个推杆 ,推杆2和推杆3" ] }, { "cell_type": "code", "execution_count": 157, "metadata": {}, "outputs": [], "source": [ "###推杆伸出" ] }, { "cell_type": "code", "execution_count": 158, "metadata": {}, "outputs": [], "source": [ "###第7步伸出,相关数据\n", "block_step_7=[6,7,8]" ] }, { "cell_type": "code", "execution_count": 159, "metadata": {}, "outputs": [], "source": [ "data_step_7=data_in[data_in[\"steps\"].isin(block_step_7)]" ] }, { "cell_type": "code", "execution_count": 160, "metadata": {}, "outputs": [], "source": [ "data_step_7_pushrod2=data_step_7[[\"time\",\"change_flag\",\"steps\",\"pushrod2_retracted\",\"pushrod2_extended\"]]\n", "data_step_7_pushrod3=data_step_7[[\"time\",\"change_flag\",\"steps\",\"pushrod3_retracted\",\"pushrod3_extended\"]]" ] }, { "cell_type": "code", "execution_count": 161, "metadata": {}, "outputs": [], "source": [ "##构建推杆伸出函数" ] }, { "cell_type": "code", "execution_count": 162, "metadata": {}, "outputs": [], "source": [ "def pushrod_extend_time(data_step_pushrod,upd=6,cored=7,downd=8):\n", " data_step_pushrod.columns=[\"time\",\"change_flag\",\"steps\",\"pushrod_retracted\",\"pushrod_extended\"]\n", " exchange_process_list=list(set(data_step_pushrod[\"change_flag\"]))\n", " union_t=pd.DataFrame()\n", " result_f=pd.DataFrame()\n", " result_r=pd.DataFrame()\n", " \n", " for change_flag in exchange_process_list:\n", " step_up_last=data_step_pushrod[(data_step_pushrod[\"change_flag\"]==change_flag)&(data_step_pushrod[\"steps\"]==upd)].tail(1)\n", " step_core=data_step_pushrod[(data_step_pushrod[\"change_flag\"]==change_flag)&(data_step_pushrod[\"steps\"]==cored)]\n", " step_down_first=data_step_pushrod[(data_step_pushrod[\"change_flag\"]==change_flag)&(data_step_pushrod[\"steps\"]==downd)]\n", " fulld=pd.concat([step_up_last,step_core,step_down_first],axis=0,ignore_index=True)\n", " act_first=fulld[fulld[\"pushrod_retracted\"]==1].tail(1)\n", " act_last=fulld[fulld[\"pushrod_extended\"]==1].head(1)\n", " union=pd.concat([step_up_last,act_first,act_last],axis=0,ignore_index=True)\n", " union_t=pd.concat([union_t,union],axis=0,ignore_index=True)\n", " \n", " union_t[\"time2\"]=union_t[\"time\"].shift(1)\n", " result=union_t.groupby('change_flag').tail(2)\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds() \n", "\n", " result_f =result.groupby('change_flag').head(1)\n", " result_f=result_f[['change_flag','steps','time_delta']]\n", " result_f.columns=['change_flag','steps','pushrod_f_time']\n", " result_f[\"steps\"]=cored\n", " result_r =result.groupby('change_flag').tail(1)\n", " result_r=result_r[['change_flag','steps','time_delta']]\n", " result_r.columns=['change_flag','steps','pushrod_r_time']\n", " result_r[\"steps\"]=cored\n", " \n", " return result_f,result_r" ] }, { "cell_type": "code", "execution_count": 163, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/4221840794.py:20: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "result_f72,result_r72=pushrod_extend_time(data_step_7_pushrod2)\n", "result_f73,result_r73=pushrod_extend_time(data_step_7_pushrod3)" ] }, { "cell_type": "code", "execution_count": 164, "metadata": {}, "outputs": [], "source": [ "###伸出的步骤还有21,35" ] }, { "cell_type": "code", "execution_count": 165, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/4221840794.py:20: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "block_step_21=[20,21,22]\n", "data_step_21=data_in[data_in[\"steps\"].isin(block_step_21)]\n", "data_step_21_pushrod2=data_step_21[[\"time\",\"change_flag\",\"steps\",\"pushrod2_retracted\",\"pushrod2_extended\"]]\n", "data_step_21_pushrod3=data_step_21[[\"time\",\"change_flag\",\"steps\",\"pushrod3_retracted\",\"pushrod3_extended\"]]\n", "result_f212,result_r212=pushrod_extend_time(data_step_21_pushrod2,upd=20,cored=21,downd=22)\n", "result_f213,result_r213=pushrod_extend_time(data_step_21_pushrod3,upd=20,cored=21,downd=22)" ] }, { "cell_type": "code", "execution_count": 166, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/4221840794.py:20: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "block_step_35=[34,35,36]\n", "data_step_35=data_in[data_in[\"steps\"].isin(block_step_35)]\n", "data_step_35_pushrod2=data_step_35[[\"time\",\"change_flag\",\"steps\",\"pushrod2_retracted\",\"pushrod2_extended\"]]\n", "data_step_35_pushrod3=data_step_35[[\"time\",\"change_flag\",\"steps\",\"pushrod3_retracted\",\"pushrod3_extended\"]]\n", "result_f352,result_r352=pushrod_extend_time(data_step_35_pushrod2,upd=34,cored=35,downd=36)\n", "result_f353,result_r353=pushrod_extend_time(data_step_35_pushrod3,upd=34,cored=35,downd=36)" ] }, { "cell_type": "code", "execution_count": 167, "metadata": {}, "outputs": [], "source": [ "##构建推杆收回函数,11步为收回" ] }, { "cell_type": "code", "execution_count": 168, "metadata": {}, "outputs": [], "source": [ "block_step_11=[10,11,12]" ] }, { "cell_type": "code", "execution_count": 169, "metadata": {}, "outputs": [], "source": [ "def pushrod_retracted_time(data_step_pushrod,upd=10,cored=11,downd=12):\n", " data_step_pushrod.columns=[\"time\",\"change_flag\",\"steps\",\"pushrod_retracted\",\"pushrod_extended\"]\n", " exchange_process_list=list(set(data_step_pushrod[\"change_flag\"]))\n", " union_t=pd.DataFrame()\n", " result_f=pd.DataFrame()\n", " result_r=pd.DataFrame()\n", " \n", " for change_flag in exchange_process_list:\n", " step_up_last=data_step_pushrod[(data_step_pushrod[\"change_flag\"]==change_flag)&(data_step_pushrod[\"steps\"]==upd)].tail(1)\n", " step_core=data_step_pushrod[(data_step_pushrod[\"change_flag\"]==change_flag)&(data_step_pushrod[\"steps\"]==cored)]\n", " step_down_first=data_step_pushrod[(data_step_pushrod[\"change_flag\"]==change_flag)&(data_step_pushrod[\"steps\"]==downd)]\n", " fulld=pd.concat([step_up_last,step_core,step_down_first],axis=0,ignore_index=True)\n", " act_first=fulld[fulld[\"pushrod_extended\"]==1].tail(1)\n", " act_last=fulld[fulld[\"pushrod_retracted\"]==1].head(1)\n", " union=pd.concat([step_up_last,act_first,act_last],axis=0,ignore_index=True)\n", " union_t=pd.concat([union_t,union],axis=0,ignore_index=True)\n", " \n", " union_t[\"time2\"]=union_t[\"time\"].shift(1)\n", " result=union_t.groupby('change_flag').tail(2)\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds() \n", "\n", " result_f =result.groupby('change_flag').head(1)\n", " result_f=result_f[['change_flag','steps','time_delta']]\n", " result_f.columns=['change_flag','steps','pushrod_f_time']\n", " result_f[\"steps\"]=cored\n", " result_r =result.groupby('change_flag').tail(1)\n", " result_r=result_r[['change_flag','steps','time_delta']]\n", " result_r.columns=['change_flag','steps','pushrod_r_time']\n", " result_r[\"steps\"]=cored\n", " \n", " return result_f,result_r" ] }, { "cell_type": "code", "execution_count": 170, "metadata": {}, "outputs": [], "source": [ "##推杆收回的步骤还有25,39" ] }, { "cell_type": "code", "execution_count": 171, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/4039671398.py:20: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "block_step_11=[10,11,12]\n", "data_step_11=data_in[data_in[\"steps\"].isin(block_step_11)]\n", "data_step_11_pushrod2=data_step_11[[\"time\",\"change_flag\",\"steps\",\"pushrod2_retracted\",\"pushrod2_extended\"]]\n", "data_step_11_pushrod3=data_step_11[[\"time\",\"change_flag\",\"steps\",\"pushrod3_retracted\",\"pushrod3_extended\"]]\n", "result_f112,result_r112=pushrod_retracted_time(data_step_11_pushrod2,upd=10,cored=11,downd=12)\n", "result_f113,result_r113=pushrod_retracted_time(data_step_11_pushrod3,upd=10,cored=11,downd=12)" ] }, { "cell_type": "code", "execution_count": 172, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/4039671398.py:20: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "block_step_25=[24,25,26]\n", "data_step_25=data_in[data_in[\"steps\"].isin(block_step_25)]\n", "data_step_25_pushrod2=data_step_25[[\"time\",\"change_flag\",\"steps\",\"pushrod2_retracted\",\"pushrod2_extended\"]]\n", "data_step_25_pushrod3=data_step_25[[\"time\",\"change_flag\",\"steps\",\"pushrod3_retracted\",\"pushrod3_extended\"]]\n", "result_f252,result_r252=pushrod_retracted_time(data_step_25_pushrod2,upd=24,cored=25,downd=26)\n", "result_f253,result_r253=pushrod_retracted_time(data_step_25_pushrod3,upd=24,cored=25,downd=26)" ] }, { "cell_type": "code", "execution_count": 173, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2105007/4039671398.py:20: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " result[\"time_delta\"]=pd.to_timedelta(pd.to_datetime(result[\"time\"])-pd.to_datetime(result[\"time2\"])).dt.total_seconds()\n" ] } ], "source": [ "block_step_39=[38,39,40]\n", "data_step_39=data_in[data_in[\"steps\"].isin(block_step_39)]\n", "data_step_39_pushrod2=data_step_39[[\"time\",\"change_flag\",\"steps\",\"pushrod2_retracted\",\"pushrod2_extended\"]]\n", "data_step_39_pushrod3=data_step_39[[\"time\",\"change_flag\",\"steps\",\"pushrod3_retracted\",\"pushrod3_extended\"]]\n", "result_f392,result_r392=pushrod_retracted_time(data_step_39_pushrod2,upd=38,cored=39,downd=40)\n", "result_f393,result_r393=pushrod_retracted_time(data_step_39_pushrod3,upd=38,cored=39,downd=40)" ] }, { "cell_type": "code", "execution_count": 174, "metadata": {}, "outputs": [], "source": [ "###扭矩、位移、拉力按换电过程和换电步骤汇总,汇总对象为data_in" ] }, { "cell_type": "code", "execution_count": 175, "metadata": {}, "outputs": [], "source": [ "data_describe=data_in.groupby(['change_flag','steps']).agg({'x_v':['mean','min','max'],\n", " 'y_v':['mean','min','max'],\n", " 'z_v':['mean','min','max'],\n", " 'r_v':['mean','min','max'],\n", " 'x_s':['mean','min','max'],\n", " 'y_s':['mean','min','max'],\n", " 'z_s':['mean','min','max'],\n", " 'r_s':['mean','min','max'],\n", " 'x1_toque':['mean','min','max'],\n", " 'x2_toque':['mean','min','max'],\n", " 'y_toque':['mean','min','max'],\n", " 'z_toque':['mean','min','max'],\n", " 'r_toque':['mean','min','max'],\n", " 'pressure_1':['mean','min','max'],\n", " 'pressure_2':['mean','min','max'],\n", " 'pressure_3':['mean','min','max'],\n", " 'pressure_4':['mean','min','max']})" ] }, { "cell_type": "code", "execution_count": 176, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
x_vy_vz_vr_v...pressure_1pressure_2pressure_3pressure_4
meanminmaxmeanminmaxmeanminmaxmean...maxmeanminmaxmeanminmaxmeanminmax
change_flagsteps
24449.456710-0.374507232.9433420.037731-0.3018490.377312-42.340176-50.184946-0.1075270.002254...81.756.24636454.459.054.45181851.557.67.1727274.49.9
4190.2784480.074901181.8605940.005099-0.3018490.3018490.002383-0.0258060.038710-0.005670...80.155.56621654.056.754.20675752.455.47.4500006.48.6
2-32.885101-221.483429100.5176750.034887-0.3773120.4527746.906641-0.03871045.7935480.349026...81.655.65929654.757.454.27587952.756.57.4140706.09.5
30.009913-0.2996060.299606493.114248-0.226387800.806441-0.001265-0.0258060.017204-0.004768...96.853.18676536.661.052.09705939.760.610.1411763.820.3
4-0.007748-0.2996060.299606-0.000867-0.3773120.301849-37.950018-50.086021-1.002151-0.001973...113.853.66896615.761.353.02643716.060.60.004598-46.811.5
.....................................................................
2842-34.004477-222.606950100.5925760.048784-0.3018490.3773127.103660-0.03871046.8172040.206051...63.680.04646577.282.073.91616270.775.8-15.726263-17.6-13.7
3-0.005507-0.2247040.299606491.223251-0.150925803.145699-0.000506-0.0258060.0258060.001122...76.270.48235355.482.464.97647146.776.1-6.069118-17.89.2
4-0.029790-0.4494080.2996060.034301-0.2263870.301849-38.114223-50.133333-0.2838710.000867...116.466.22159116.176.360.37386412.571.1-9.737500-45.3-0.9
5-0.042801-0.2996060.149803-0.032341-0.2263870.075462-0.007373-0.0774190.017204-0.002725...116.016.10000016.116.112.40000012.412.4-45.200000-45.2-45.2
6-0.021295-0.4494080.2996060.029593-0.3018490.45277437.7789580.03871050.2623650.001870...1223.7485.69215716.1759.7456.80588212.4711.0407.787255-47.3744.7
\n", "

5786 rows × 51 columns

\n", "
" ], "text/plain": [ " x_v y_v \\\n", " mean min max mean min \n", "change_flag steps \n", "2 44 49.456710 -0.374507 232.943342 0.037731 -0.301849 \n", "4 1 90.278448 0.074901 181.860594 0.005099 -0.301849 \n", " 2 -32.885101 -221.483429 100.517675 0.034887 -0.377312 \n", " 3 0.009913 -0.299606 0.299606 493.114248 -0.226387 \n", " 4 -0.007748 -0.299606 0.299606 -0.000867 -0.377312 \n", "... ... ... ... ... ... \n", "284 2 -34.004477 -222.606950 100.592576 0.048784 -0.301849 \n", " 3 -0.005507 -0.224704 0.299606 491.223251 -0.150925 \n", " 4 -0.029790 -0.449408 0.299606 0.034301 -0.226387 \n", " 5 -0.042801 -0.299606 0.149803 -0.032341 -0.226387 \n", " 6 -0.021295 -0.449408 0.299606 0.029593 -0.301849 \n", "\n", " z_v r_v ... \\\n", " max mean min max mean ... \n", "change_flag steps ... \n", "2 44 0.377312 -42.340176 -50.184946 -0.107527 0.002254 ... \n", "4 1 0.301849 0.002383 -0.025806 0.038710 -0.005670 ... \n", " 2 0.452774 6.906641 -0.038710 45.793548 0.349026 ... \n", " 3 800.806441 -0.001265 -0.025806 0.017204 -0.004768 ... \n", " 4 0.301849 -37.950018 -50.086021 -1.002151 -0.001973 ... \n", "... ... ... ... ... ... ... \n", "284 2 0.377312 7.103660 -0.038710 46.817204 0.206051 ... \n", " 3 803.145699 -0.000506 -0.025806 0.025806 0.001122 ... \n", " 4 0.301849 -38.114223 -50.133333 -0.283871 0.000867 ... \n", " 5 0.075462 -0.007373 -0.077419 0.017204 -0.002725 ... \n", " 6 0.452774 37.778958 0.038710 50.262365 0.001870 ... \n", "\n", " pressure_1 pressure_2 pressure_3 \\\n", " max mean min max mean min \n", "change_flag steps \n", "2 44 81.7 56.246364 54.4 59.0 54.451818 51.5 \n", "4 1 80.1 55.566216 54.0 56.7 54.206757 52.4 \n", " 2 81.6 55.659296 54.7 57.4 54.275879 52.7 \n", " 3 96.8 53.186765 36.6 61.0 52.097059 39.7 \n", " 4 113.8 53.668966 15.7 61.3 53.026437 16.0 \n", "... ... ... ... ... ... ... \n", "284 2 63.6 80.046465 77.2 82.0 73.916162 70.7 \n", " 3 76.2 70.482353 55.4 82.4 64.976471 46.7 \n", " 4 116.4 66.221591 16.1 76.3 60.373864 12.5 \n", " 5 116.0 16.100000 16.1 16.1 12.400000 12.4 \n", " 6 1223.7 485.692157 16.1 759.7 456.805882 12.4 \n", "\n", " pressure_4 \n", " max mean min max \n", "change_flag steps \n", "2 44 57.6 7.172727 4.4 9.9 \n", "4 1 55.4 7.450000 6.4 8.6 \n", " 2 56.5 7.414070 6.0 9.5 \n", " 3 60.6 10.141176 3.8 20.3 \n", " 4 60.6 0.004598 -46.8 11.5 \n", "... ... ... ... ... \n", "284 2 75.8 -15.726263 -17.6 -13.7 \n", " 3 76.1 -6.069118 -17.8 9.2 \n", " 4 71.1 -9.737500 -45.3 -0.9 \n", " 5 12.4 -45.200000 -45.2 -45.2 \n", " 6 711.0 407.787255 -47.3 744.7 \n", "\n", "[5786 rows x 51 columns]" ] }, "execution_count": 176, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data_describe" ] }, { "cell_type": "code", "execution_count": 177, "metadata": {}, "outputs": [], "source": [ "data_describe=data_describe.reset_index()" ] }, { "cell_type": "code", "execution_count": 178, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
change_flagstepsx_vy_vz_v...pressure_1pressure_2pressure_3pressure_4
meanminmaxmeanminmaxmeanmin...maxmeanminmaxmeanminmaxmeanminmax
024449.456710-0.374507232.9433420.037731-0.3018490.377312-42.340176-50.184946...81.756.24636454.459.054.45181851.557.67.1727274.49.9
14190.2784480.074901181.8605940.005099-0.3018490.3018490.002383-0.025806...80.155.56621654.056.754.20675752.455.47.4500006.48.6
242-32.885101-221.483429100.5176750.034887-0.3773120.4527746.906641-0.038710...81.655.65929654.757.454.27587952.756.57.4140706.09.5
3430.009913-0.2996060.299606493.114248-0.226387800.806441-0.001265-0.025806...96.853.18676536.661.052.09705939.760.610.1411763.820.3
444-0.007748-0.2996060.299606-0.000867-0.3773120.301849-37.950018-50.086021...113.853.66896615.761.353.02643716.060.60.004598-46.811.5
..................................................................
57812842-34.004477-222.606950100.5925760.048784-0.3018490.3773127.103660-0.038710...63.680.04646577.282.073.91616270.775.8-15.726263-17.6-13.7
57822843-0.005507-0.2247040.299606491.223251-0.150925803.145699-0.000506-0.025806...76.270.48235355.482.464.97647146.776.1-6.069118-17.89.2
57832844-0.029790-0.4494080.2996060.034301-0.2263870.301849-38.114223-50.133333...116.466.22159116.176.360.37386412.571.1-9.737500-45.3-0.9
57842845-0.042801-0.2996060.149803-0.032341-0.2263870.075462-0.007373-0.077419...116.016.10000016.116.112.40000012.412.4-45.200000-45.2-45.2
57852846-0.021295-0.4494080.2996060.029593-0.3018490.45277437.7789580.038710...1223.7485.69215716.1759.7456.80588212.4711.0407.787255-47.3744.7
\n", "

5786 rows × 53 columns

\n", "
" ], "text/plain": [ " change_flag steps x_v y_v \\\n", " mean min max mean \n", "0 2 44 49.456710 -0.374507 232.943342 0.037731 \n", "1 4 1 90.278448 0.074901 181.860594 0.005099 \n", "2 4 2 -32.885101 -221.483429 100.517675 0.034887 \n", "3 4 3 0.009913 -0.299606 0.299606 493.114248 \n", "4 4 4 -0.007748 -0.299606 0.299606 -0.000867 \n", "... ... ... ... ... ... ... \n", "5781 284 2 -34.004477 -222.606950 100.592576 0.048784 \n", "5782 284 3 -0.005507 -0.224704 0.299606 491.223251 \n", "5783 284 4 -0.029790 -0.449408 0.299606 0.034301 \n", "5784 284 5 -0.042801 -0.299606 0.149803 -0.032341 \n", "5785 284 6 -0.021295 -0.449408 0.299606 0.029593 \n", "\n", " z_v ... pressure_1 pressure_2 \\\n", " min max mean min ... max mean \n", "0 -0.301849 0.377312 -42.340176 -50.184946 ... 81.7 56.246364 \n", "1 -0.301849 0.301849 0.002383 -0.025806 ... 80.1 55.566216 \n", "2 -0.377312 0.452774 6.906641 -0.038710 ... 81.6 55.659296 \n", "3 -0.226387 800.806441 -0.001265 -0.025806 ... 96.8 53.186765 \n", "4 -0.377312 0.301849 -37.950018 -50.086021 ... 113.8 53.668966 \n", "... ... ... ... ... ... ... ... \n", "5781 -0.301849 0.377312 7.103660 -0.038710 ... 63.6 80.046465 \n", "5782 -0.150925 803.145699 -0.000506 -0.025806 ... 76.2 70.482353 \n", "5783 -0.226387 0.301849 -38.114223 -50.133333 ... 116.4 66.221591 \n", "5784 -0.226387 0.075462 -0.007373 -0.077419 ... 116.0 16.100000 \n", "5785 -0.301849 0.452774 37.778958 0.038710 ... 1223.7 485.692157 \n", "\n", " pressure_3 pressure_4 \n", " min max mean min max mean min max \n", "0 54.4 59.0 54.451818 51.5 57.6 7.172727 4.4 9.9 \n", "1 54.0 56.7 54.206757 52.4 55.4 7.450000 6.4 8.6 \n", "2 54.7 57.4 54.275879 52.7 56.5 7.414070 6.0 9.5 \n", "3 36.6 61.0 52.097059 39.7 60.6 10.141176 3.8 20.3 \n", "4 15.7 61.3 53.026437 16.0 60.6 0.004598 -46.8 11.5 \n", "... ... ... ... ... ... ... ... ... \n", "5781 77.2 82.0 73.916162 70.7 75.8 -15.726263 -17.6 -13.7 \n", "5782 55.4 82.4 64.976471 46.7 76.1 -6.069118 -17.8 9.2 \n", "5783 16.1 76.3 60.373864 12.5 71.1 -9.737500 -45.3 -0.9 \n", "5784 16.1 16.1 12.400000 12.4 12.4 -45.200000 -45.2 -45.2 \n", "5785 16.1 759.7 456.805882 12.4 711.0 407.787255 -47.3 744.7 \n", "\n", "[5786 rows x 53 columns]" ] }, "execution_count": 178, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data_describe" ] }, { "cell_type": "code", "execution_count": 179, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "MultiIndex([('change_flag', ''),\n", " ( 'steps', ''),\n", " ( 'x_v', 'mean'),\n", " ( 'x_v', 'min'),\n", " ( 'x_v', 'max'),\n", " ( 'y_v', 'mean'),\n", " ( 'y_v', 'min'),\n", " ( 'y_v', 'max'),\n", " ( 'z_v', 'mean'),\n", " ( 'z_v', 'min'),\n", " ( 'z_v', 'max'),\n", " ( 'r_v', 'mean'),\n", " ( 'r_v', 'min'),\n", " ( 'r_v', 'max'),\n", " ( 'x_s', 'mean'),\n", " ( 'x_s', 'min'),\n", " ( 'x_s', 'max'),\n", " ( 'y_s', 'mean'),\n", " ( 'y_s', 'min'),\n", " ( 'y_s', 'max'),\n", " ( 'z_s', 'mean'),\n", " ( 'z_s', 'min'),\n", " ( 'z_s', 'max'),\n", " ( 'r_s', 'mean'),\n", " ( 'r_s', 'min'),\n", " ( 'r_s', 'max'),\n", " ( 'x1_toque', 'mean'),\n", " ( 'x1_toque', 'min'),\n", " ( 'x1_toque', 'max'),\n", " ( 'x2_toque', 'mean'),\n", " ( 'x2_toque', 'min'),\n", " ( 'x2_toque', 'max'),\n", " ( 'y_toque', 'mean'),\n", " ( 'y_toque', 'min'),\n", " ( 'y_toque', 'max'),\n", " ( 'z_toque', 'mean'),\n", " ( 'z_toque', 'min'),\n", " ( 'z_toque', 'max'),\n", " ( 'r_toque', 'mean'),\n", " ( 'r_toque', 'min'),\n", " ( 'r_toque', 'max'),\n", " ( 'pressure_1', 'mean'),\n", " ( 'pressure_1', 'min'),\n", " ( 'pressure_1', 'max'),\n", " ( 'pressure_2', 'mean'),\n", " ( 'pressure_2', 'min'),\n", " ( 'pressure_2', 'max'),\n", " ( 'pressure_3', 'mean'),\n", " ( 'pressure_3', 'min'),\n", " ( 'pressure_3', 'max'),\n", " ( 'pressure_4', 'mean'),\n", " ( 'pressure_4', 'min'),\n", " ( 'pressure_4', 'max')],\n", " )" ] }, "execution_count": 179, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data_describe.columns\n" ] }, { "cell_type": "code", "execution_count": 180, "metadata": {}, "outputs": [], "source": [ "columns_names=[\"change_flag\",\n", " \"steps\",\n", " \"x_v_mean\",\n", " \"x_v_min\",\n", " \"x_v_max\",\n", " \"y_v_mean\",\n", " \"y_v_min\",\n", " \"y_v_max\",\n", " \"z_v_mean\",\n", " \"z_v_min\",\n", " \"z_v_max\",\n", " \"r_v_mean\",\n", " \"r_v_min\",\n", " \"r_v_max\",\n", " \"x_s_mean\",\n", " \"x_s_min\",\n", " \"x_s_max\",\n", " \"y_s_mean\",\n", " \"y_s_min\",\n", " \"y_s_max\",\n", " \"z_s_mean\",\n", " \"z_s_min\",\n", " \"z_s_max\",\n", " \"r_s_mean\",\n", " \"r_s_min\",\n", " \"r_s_max\",\n", " \"x1_tq_mean\",\n", " \"x1_tq_min\",\n", " \"x1_tq_max\",\n", " \"x2_tq_mean\",\n", " \"x2_tq_min\",\n", " \"x2_tq_max\",\n", " \"y_tq_mean\",\n", " \"y_tq_min\",\n", " \"y_tq_max\",\n", " \"z_tq_mean\",\n", " \"z_tq_min\",\n", " \"z_tq_max\",\n", " \"r_tq_mean\",\n", " \"r_tq_min\",\n", " \"r_tq_max\",\n", " \"pres_1_mean\",\n", " \"pres_1_min\",\n", " \"pres_1_max\",\n", " \"pres_2_mean\",\n", " \"pres_2_min\",\n", " \"pres_2_max\",\n", " \"pres_3_mean\",\n", " \"pres_3_min\",\n", " \"pres_3_max\",\n", " \"pres_4_mean\",\n", " \"pres_4_mean\",\n", " \"pres_4_min\"\n", " ]" ] }, { "cell_type": "code", "execution_count": 181, "metadata": {}, "outputs": [], "source": [ "data_describe.columns=columns_names" ] }, { "cell_type": "code", "execution_count": 182, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "53" ] }, "execution_count": 182, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(columns_names)" ] }, { "cell_type": "code", "execution_count": 183, "metadata": {}, "outputs": [], "source": [ "data_describe.to_csv(\"data_descrive_10.csv\",index=False)" ] }, { "cell_type": "code", "execution_count": 184, "metadata": {}, "outputs": [], "source": [ "###基于换电过程和换电步骤的汇总" ] }, { "cell_type": "code", "execution_count": 185, "metadata": {}, "outputs": [], "source": [ "##基表time_group_steps" ] }, { "cell_type": "code", "execution_count": 186, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timesnstepsstatusx_vy_vz_vr_vpausex_s...pushrod3_out_timepushrod2_in_timepushrod3_in_timepushrod1_out_timepushrod4_out_timepushrod1_in_timepushrod4_in_timechange_flagtime2time_delta
12023-06-10 00:18:46.986plc4430.074901-0.150925-4.034408-0.0381470.099.999990...0.00.00.05000.05000.05000.05000.022023-06-10 00:18:36.08610.9
32023-06-10 00:50:03.586plc124.4940830.0000000.0172040.0000000.0669.779543...0.00.00.05000.05000.05000.05000.042023-06-10 00:49:56.2867.3
52023-06-10 00:50:23.486plc22-4.4940830.0000000.0086020.0000000.011.720324...0.00.00.05000.05000.05000.05000.042023-06-10 00:50:03.68619.8
72023-06-10 00:50:30.286plc32-0.07490122.4123150.0086020.0381470.011.608543...0.00.00.05000.05000.05000.05000.042023-06-10 00:50:23.5866.7
92023-06-10 00:50:39.086plc42-0.0749010.150925-1.0021510.0190730.011.608557...0.00.00.05000.05000.05000.05000.042023-06-10 00:50:30.3868.7
..................................................................
115632023-06-10 23:59:32.186plc22-8.0144490.3018490.0172040.0000000.0-3.007475...0.00.00.05000.05000.05000.05000.02842023-06-10 23:59:12.48619.7
115652023-06-10 23:59:38.986plc32-0.14980326.7136690.0000000.0190730.0-3.315217...0.00.00.05000.05000.05000.05000.02842023-06-10 23:59:32.2866.7
115672023-06-10 23:59:47.786plc420.0000000.000000-1.1311830.0572200.0-3.315208...0.00.00.05000.05000.05000.05000.02842023-06-10 23:59:39.0868.7
115692023-06-10 23:59:48.486plc520.0000000.075462-0.0086020.0000000.0-3.315217...0.00.00.05000.05000.05000.05000.02842023-06-10 23:59:47.8860.6
115712023-06-10 23:59:58.986plc620.0749010.07546250.0086020.0000000.0-3.315226...0.00.00.05000.05000.05000.05000.02842023-06-10 23:59:48.58610.4
\n", "

5786 rows × 115 columns

\n", "
" ], "text/plain": [ " time sn steps status x_v y_v \\\n", "1 2023-06-10 00:18:46.986 plc 44 3 0.074901 -0.150925 \n", "3 2023-06-10 00:50:03.586 plc 1 2 4.494083 0.000000 \n", "5 2023-06-10 00:50:23.486 plc 2 2 -4.494083 0.000000 \n", "7 2023-06-10 00:50:30.286 plc 3 2 -0.074901 22.412315 \n", "9 2023-06-10 00:50:39.086 plc 4 2 -0.074901 0.150925 \n", "... ... ... ... ... ... ... \n", "11563 2023-06-10 23:59:32.186 plc 2 2 -8.014449 0.301849 \n", "11565 2023-06-10 23:59:38.986 plc 3 2 -0.149803 26.713669 \n", "11567 2023-06-10 23:59:47.786 plc 4 2 0.000000 0.000000 \n", "11569 2023-06-10 23:59:48.486 plc 5 2 0.000000 0.075462 \n", "11571 2023-06-10 23:59:58.986 plc 6 2 0.074901 0.075462 \n", "\n", " z_v r_v pause x_s ... pushrod3_out_time \\\n", "1 -4.034408 -0.038147 0.0 99.999990 ... 0.0 \n", "3 0.017204 0.000000 0.0 669.779543 ... 0.0 \n", "5 0.008602 0.000000 0.0 11.720324 ... 0.0 \n", "7 0.008602 0.038147 0.0 11.608543 ... 0.0 \n", "9 -1.002151 0.019073 0.0 11.608557 ... 0.0 \n", "... ... ... ... ... ... ... \n", "11563 0.017204 0.000000 0.0 -3.007475 ... 0.0 \n", "11565 0.000000 0.019073 0.0 -3.315217 ... 0.0 \n", "11567 -1.131183 0.057220 0.0 -3.315208 ... 0.0 \n", "11569 -0.008602 0.000000 0.0 -3.315217 ... 0.0 \n", "11571 50.008602 0.000000 0.0 -3.315226 ... 0.0 \n", "\n", " pushrod2_in_time pushrod3_in_time pushrod1_out_time \\\n", "1 0.0 0.0 5000.0 \n", "3 0.0 0.0 5000.0 \n", "5 0.0 0.0 5000.0 \n", "7 0.0 0.0 5000.0 \n", "9 0.0 0.0 5000.0 \n", "... ... ... ... \n", "11563 0.0 0.0 5000.0 \n", "11565 0.0 0.0 5000.0 \n", "11567 0.0 0.0 5000.0 \n", "11569 0.0 0.0 5000.0 \n", "11571 0.0 0.0 5000.0 \n", "\n", " pushrod4_out_time pushrod1_in_time pushrod4_in_time change_flag \\\n", "1 5000.0 5000.0 5000.0 2 \n", "3 5000.0 5000.0 5000.0 4 \n", "5 5000.0 5000.0 5000.0 4 \n", "7 5000.0 5000.0 5000.0 4 \n", "9 5000.0 5000.0 5000.0 4 \n", "... ... ... ... ... \n", "11563 5000.0 5000.0 5000.0 284 \n", "11565 5000.0 5000.0 5000.0 284 \n", "11567 5000.0 5000.0 5000.0 284 \n", "11569 5000.0 5000.0 5000.0 284 \n", "11571 5000.0 5000.0 5000.0 284 \n", "\n", " time2 time_delta \n", "1 2023-06-10 00:18:36.086 10.9 \n", "3 2023-06-10 00:49:56.286 7.3 \n", "5 2023-06-10 00:50:03.686 19.8 \n", "7 2023-06-10 00:50:23.586 6.7 \n", "9 2023-06-10 00:50:30.386 8.7 \n", "... ... ... \n", "11563 2023-06-10 23:59:12.486 19.7 \n", "11565 2023-06-10 23:59:32.286 6.7 \n", "11567 2023-06-10 23:59:39.086 8.7 \n", "11569 2023-06-10 23:59:47.886 0.6 \n", "11571 2023-06-10 23:59:48.586 10.4 \n", "\n", "[5786 rows x 115 columns]" ] }, "execution_count": 186, "metadata": {}, "output_type": "execute_result" } ], "source": [ "time_group_steps" ] }, { "cell_type": "code", "execution_count": 187, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['time', 'sn', 'steps', 'status', 'x_v', 'y_v', 'z_v', 'r_v', 'pause',\n", " 'x_s',\n", " ...\n", " 'pushrod3_out_time', 'pushrod2_in_time', 'pushrod3_in_time',\n", " 'pushrod1_out_time', 'pushrod4_out_time', 'pushrod1_in_time',\n", " 'pushrod4_in_time', 'change_flag', 'time2', 'time_delta'],\n", " dtype='object', length=115)" ] }, "execution_count": 187, "metadata": {}, "output_type": "execute_result" } ], "source": [ "time_group_steps.columns" ] }, { "cell_type": "code", "execution_count": 233, "metadata": {}, "outputs": [], "source": [ "group_steps_base=time_group_steps[[\"time2\",\"time\",\"time_delta\",\"change_flag\",\"steps\"]]" ] }, { "cell_type": "code", "execution_count": 234, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
time2timetime_deltachange_flagsteps
12023-06-10 00:18:36.0862023-06-10 00:18:46.98610.9244
32023-06-10 00:49:56.2862023-06-10 00:50:03.5867.341
52023-06-10 00:50:03.6862023-06-10 00:50:23.48619.842
72023-06-10 00:50:23.5862023-06-10 00:50:30.2866.743
92023-06-10 00:50:30.3862023-06-10 00:50:39.0868.744
..................
115632023-06-10 23:59:12.4862023-06-10 23:59:32.18619.72842
115652023-06-10 23:59:32.2862023-06-10 23:59:38.9866.72843
115672023-06-10 23:59:39.0862023-06-10 23:59:47.7868.72844
115692023-06-10 23:59:47.8862023-06-10 23:59:48.4860.62845
115712023-06-10 23:59:48.5862023-06-10 23:59:58.98610.42846
\n", "

5786 rows × 5 columns

\n", "
" ], "text/plain": [ " time2 time time_delta \\\n", "1 2023-06-10 00:18:36.086 2023-06-10 00:18:46.986 10.9 \n", "3 2023-06-10 00:49:56.286 2023-06-10 00:50:03.586 7.3 \n", "5 2023-06-10 00:50:03.686 2023-06-10 00:50:23.486 19.8 \n", "7 2023-06-10 00:50:23.586 2023-06-10 00:50:30.286 6.7 \n", "9 2023-06-10 00:50:30.386 2023-06-10 00:50:39.086 8.7 \n", "... ... ... ... \n", "11563 2023-06-10 23:59:12.486 2023-06-10 23:59:32.186 19.7 \n", "11565 2023-06-10 23:59:32.286 2023-06-10 23:59:38.986 6.7 \n", "11567 2023-06-10 23:59:39.086 2023-06-10 23:59:47.786 8.7 \n", "11569 2023-06-10 23:59:47.886 2023-06-10 23:59:48.486 0.6 \n", "11571 2023-06-10 23:59:48.586 2023-06-10 23:59:58.986 10.4 \n", "\n", " change_flag steps \n", "1 2 44 \n", "3 4 1 \n", "5 4 2 \n", "7 4 3 \n", "9 4 4 \n", "... ... ... \n", "11563 284 2 \n", "11565 284 3 \n", "11567 284 4 \n", "11569 284 5 \n", "11571 284 6 \n", "\n", "[5786 rows x 5 columns]" ] }, "execution_count": 234, "metadata": {}, "output_type": "execute_result" } ], "source": [ "group_steps_base" ] }, { "cell_type": "code", "execution_count": 235, "metadata": {}, "outputs": [], "source": [ "group_steps_base.columns=[\"step_time_b\",\"step_time_e\",\"step_time\",\"change_flag\",\"steps\"]" ] }, { "cell_type": "code", "execution_count": 236, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
step_time_bstep_time_estep_timechange_flagsteps
12023-06-10 00:18:36.0862023-06-10 00:18:46.98610.9244
32023-06-10 00:49:56.2862023-06-10 00:50:03.5867.341
52023-06-10 00:50:03.6862023-06-10 00:50:23.48619.842
72023-06-10 00:50:23.5862023-06-10 00:50:30.2866.743
92023-06-10 00:50:30.3862023-06-10 00:50:39.0868.744
..................
115632023-06-10 23:59:12.4862023-06-10 23:59:32.18619.72842
115652023-06-10 23:59:32.2862023-06-10 23:59:38.9866.72843
115672023-06-10 23:59:39.0862023-06-10 23:59:47.7868.72844
115692023-06-10 23:59:47.8862023-06-10 23:59:48.4860.62845
115712023-06-10 23:59:48.5862023-06-10 23:59:58.98610.42846
\n", "

5786 rows × 5 columns

\n", "
" ], "text/plain": [ " step_time_b step_time_e step_time \\\n", "1 2023-06-10 00:18:36.086 2023-06-10 00:18:46.986 10.9 \n", "3 2023-06-10 00:49:56.286 2023-06-10 00:50:03.586 7.3 \n", "5 2023-06-10 00:50:03.686 2023-06-10 00:50:23.486 19.8 \n", "7 2023-06-10 00:50:23.586 2023-06-10 00:50:30.286 6.7 \n", "9 2023-06-10 00:50:30.386 2023-06-10 00:50:39.086 8.7 \n", "... ... ... ... \n", "11563 2023-06-10 23:59:12.486 2023-06-10 23:59:32.186 19.7 \n", "11565 2023-06-10 23:59:32.286 2023-06-10 23:59:38.986 6.7 \n", "11567 2023-06-10 23:59:39.086 2023-06-10 23:59:47.786 8.7 \n", "11569 2023-06-10 23:59:47.886 2023-06-10 23:59:48.486 0.6 \n", "11571 2023-06-10 23:59:48.586 2023-06-10 23:59:58.986 10.4 \n", "\n", " change_flag steps \n", "1 2 44 \n", "3 4 1 \n", "5 4 2 \n", "7 4 3 \n", "9 4 4 \n", "... ... ... \n", "11563 284 2 \n", "11565 284 3 \n", "11567 284 4 \n", "11569 284 5 \n", "11571 284 6 \n", "\n", "[5786 rows x 5 columns]" ] }, "execution_count": 236, "metadata": {}, "output_type": "execute_result" } ], "source": [ "group_steps_base" ] }, { "cell_type": "code", "execution_count": 237, "metadata": {}, "outputs": [], "source": [ "##关联转锁" ] }, { "cell_type": "code", "execution_count": 238, "metadata": {}, "outputs": [], "source": [ "##将转锁的数据合并" ] }, { "cell_type": "code", "execution_count": 239, "metadata": {}, "outputs": [], "source": [ "##转锁的反应时间" ] }, { "cell_type": "code", "execution_count": 240, "metadata": {}, "outputs": [], "source": [ "block1_f_union=pd.concat([result_f51,result_f131,result_f191,result_f271,result_f331,result_f411])" ] }, { "cell_type": "code", "execution_count": 241, "metadata": {}, "outputs": [], "source": [ "block1_f_union.columns=['change_flag','steps','block1_f_time']" ] }, { "cell_type": "code", "execution_count": 242, "metadata": {}, "outputs": [], "source": [ "block2_f_union=pd.concat([result_f52,result_f132,result_f192,result_f272,result_f332,result_f412])" ] }, { "cell_type": "code", "execution_count": 243, "metadata": {}, "outputs": [], "source": [ "block2_f_union.columns=['change_flag','steps','block2_f_time']" ] }, { "cell_type": "code", "execution_count": 244, "metadata": {}, "outputs": [], "source": [ "block3_f_union=pd.concat([result_f53,result_f133,result_f193,result_f273,result_f333,result_f413])\n", "block3_f_union.columns=['change_flag','steps','block3_f_time']" ] }, { "cell_type": "code", "execution_count": 245, "metadata": {}, "outputs": [], "source": [ "block4_f_union=pd.concat([result_f54,result_f134,result_f194,result_f274,result_f334,result_f414])\n", "block4_f_union.columns=['change_flag','steps','block4_f_time']" ] }, { "cell_type": "code", "execution_count": 246, "metadata": {}, "outputs": [], "source": [ "block1_r_union=pd.concat([result_r51,result_r131,result_r191,result_r271,result_r331,result_r411])\n", "block1_r_union.columns=['change_flag','steps','block1_r_time']" ] }, { "cell_type": "code", "execution_count": 247, "metadata": {}, "outputs": [], "source": [ "block2_r_union=pd.concat([result_r52,result_r132,result_r192,result_r272,result_r332,result_r412])\n", "block2_r_union.columns=['change_flag','steps','block2_r_time']" ] }, { "cell_type": "code", "execution_count": 248, "metadata": {}, "outputs": [], "source": [ "block3_r_union=pd.concat([result_r53,result_r133,result_r193,result_r273,result_r333,result_r413])\n", "block3_r_union.columns=['change_flag','steps','block3_r_time']" ] }, { "cell_type": "code", "execution_count": 249, "metadata": {}, "outputs": [], "source": [ "block4_r_union=pd.concat([result_r54,result_r134,result_r194,result_r274,result_r334,result_r414])\n", "block4_r_union.columns=['change_flag','steps','block4_r_time']" ] }, { "cell_type": "code", "execution_count": 250, "metadata": {}, "outputs": [], "source": [ "###关联转锁的反应时间" ] }, { "cell_type": "code", "execution_count": 251, "metadata": {}, "outputs": [], "source": [ "group_steps_base=pd.merge(group_steps_base,block1_f_union,on=['change_flag','steps'],how='left')" ] }, { "cell_type": "code", "execution_count": 252, "metadata": {}, "outputs": [], "source": [ "group_steps_base=pd.merge(group_steps_base,block2_f_union,on=['change_flag','steps'],how='left')" ] }, { "cell_type": "code", "execution_count": 253, "metadata": {}, "outputs": [], "source": [ "group_steps_base=pd.merge(group_steps_base,block3_f_union,on=['change_flag','steps'],how='left')" ] }, { "cell_type": "code", "execution_count": 254, "metadata": {}, "outputs": [], "source": [ "group_steps_base=pd.merge(group_steps_base,block4_f_union,on=['change_flag','steps'],how='left')" ] }, { "cell_type": "code", "execution_count": 255, "metadata": {}, "outputs": [], "source": [ "##关联运动时间\n", "group_steps_base=pd.merge(group_steps_base,block1_r_union,on=['change_flag','steps'],how='left')\n", "group_steps_base=pd.merge(group_steps_base,block2_r_union,on=['change_flag','steps'],how='left')\n", "group_steps_base=pd.merge(group_steps_base,block3_r_union,on=['change_flag','steps'],how='left')\n", "group_steps_base=pd.merge(group_steps_base,block4_r_union,on=['change_flag','steps'],how='left')" ] }, { "cell_type": "code", "execution_count": 256, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
step_time_bstep_time_estep_timechange_flagstepsblock1_f_timeblock2_f_timeblock3_f_timeblock4_f_timeblock1_r_timeblock2_r_timeblock3_r_timeblock4_r_time
02023-06-10 00:18:36.0862023-06-10 00:18:46.98610.9244NaNNaNNaNNaNNaNNaNNaNNaN
12023-06-10 00:49:56.2862023-06-10 00:50:03.5867.341NaNNaNNaNNaNNaNNaNNaNNaN
22023-06-10 00:50:03.6862023-06-10 00:50:23.48619.842NaNNaNNaNNaNNaNNaNNaNNaN
32023-06-10 00:50:23.5862023-06-10 00:50:30.2866.743NaNNaNNaNNaNNaNNaNNaNNaN
42023-06-10 00:50:30.3862023-06-10 00:50:39.0868.744NaNNaNNaNNaNNaNNaNNaNNaN
..........................................
57812023-06-10 23:59:12.4862023-06-10 23:59:32.18619.72842NaNNaNNaNNaNNaNNaNNaNNaN
57822023-06-10 23:59:32.2862023-06-10 23:59:38.9866.72843NaNNaNNaNNaNNaNNaNNaNNaN
57832023-06-10 23:59:39.0862023-06-10 23:59:47.7868.72844NaNNaNNaNNaNNaNNaNNaNNaN
57842023-06-10 23:59:47.8862023-06-10 23:59:48.4860.628450.10.10.20.10.50.50.60.6
57852023-06-10 23:59:48.5862023-06-10 23:59:58.98610.42846NaNNaNNaNNaNNaNNaNNaNNaN
\n", "

5786 rows × 13 columns

\n", "
" ], "text/plain": [ " step_time_b step_time_e step_time \\\n", "0 2023-06-10 00:18:36.086 2023-06-10 00:18:46.986 10.9 \n", "1 2023-06-10 00:49:56.286 2023-06-10 00:50:03.586 7.3 \n", "2 2023-06-10 00:50:03.686 2023-06-10 00:50:23.486 19.8 \n", "3 2023-06-10 00:50:23.586 2023-06-10 00:50:30.286 6.7 \n", "4 2023-06-10 00:50:30.386 2023-06-10 00:50:39.086 8.7 \n", "... ... ... ... \n", "5781 2023-06-10 23:59:12.486 2023-06-10 23:59:32.186 19.7 \n", "5782 2023-06-10 23:59:32.286 2023-06-10 23:59:38.986 6.7 \n", "5783 2023-06-10 23:59:39.086 2023-06-10 23:59:47.786 8.7 \n", "5784 2023-06-10 23:59:47.886 2023-06-10 23:59:48.486 0.6 \n", "5785 2023-06-10 23:59:48.586 2023-06-10 23:59:58.986 10.4 \n", "\n", " change_flag steps block1_f_time block2_f_time block3_f_time \\\n", "0 2 44 NaN NaN NaN \n", "1 4 1 NaN NaN NaN \n", "2 4 2 NaN NaN NaN \n", "3 4 3 NaN NaN NaN \n", "4 4 4 NaN NaN NaN \n", "... ... ... ... ... ... \n", "5781 284 2 NaN NaN NaN \n", "5782 284 3 NaN NaN NaN \n", "5783 284 4 NaN NaN NaN \n", "5784 284 5 0.1 0.1 0.2 \n", "5785 284 6 NaN NaN NaN \n", "\n", " block4_f_time block1_r_time block2_r_time block3_r_time \\\n", "0 NaN NaN NaN NaN \n", "1 NaN NaN NaN NaN \n", "2 NaN NaN NaN NaN \n", "3 NaN NaN NaN NaN \n", "4 NaN NaN NaN NaN \n", "... ... ... ... ... \n", "5781 NaN NaN NaN NaN \n", "5782 NaN NaN NaN NaN \n", "5783 NaN NaN NaN NaN \n", "5784 0.1 0.5 0.5 0.6 \n", "5785 NaN NaN NaN NaN \n", "\n", " block4_r_time \n", "0 NaN \n", "1 NaN \n", "2 NaN \n", "3 NaN \n", "4 NaN \n", "... ... \n", "5781 NaN \n", "5782 NaN \n", "5783 NaN \n", "5784 0.6 \n", "5785 NaN \n", "\n", "[5786 rows x 13 columns]" ] }, "execution_count": 256, "metadata": {}, "output_type": "execute_result" } ], "source": [ "group_steps_base" ] }, { "cell_type": "code", "execution_count": 257, "metadata": {}, "outputs": [], "source": [ "###关联推杆" ] }, { "cell_type": "code", "execution_count": 258, "metadata": {}, "outputs": [], "source": [ "pushrod2_f_union=pd.concat([result_f72,result_f112,result_f212,result_f252,result_f352,result_f392])" ] }, { "cell_type": "code", "execution_count": 259, "metadata": {}, "outputs": [], "source": [ "pushrod2_f_union.columns=['change_flag','steps','pushrod2_f_time']" ] }, { "cell_type": "code", "execution_count": 260, "metadata": {}, "outputs": [], "source": [ "pushrod3_f_union=pd.concat([result_f73,result_f113,result_f213,result_f253,result_f353,result_f393])" ] }, { "cell_type": "code", "execution_count": 261, "metadata": {}, "outputs": [], "source": [ "pushrod3_f_union.columns=['change_flag','steps','pushrod3_f_time']" ] }, { "cell_type": "code", "execution_count": 262, "metadata": {}, "outputs": [], "source": [ "pushrod2_r_union=pd.concat([result_r72,result_r112,result_r212,result_r252,result_r352,result_r392])" ] }, { "cell_type": "code", "execution_count": 263, "metadata": {}, "outputs": [], "source": [ "pushrod2_r_union.columns=['change_flag','steps','pushrod2_r_time']" ] }, { "cell_type": "code", "execution_count": 264, "metadata": {}, "outputs": [], "source": [ "pushrod3_r_union=pd.concat([result_r73,result_r113,result_r213,result_r253,result_r353,result_r393])\n", "pushrod3_r_union.columns=['change_flag','steps','pushrod3_r_time']" ] }, { "cell_type": "code", "execution_count": 265, "metadata": {}, "outputs": [], "source": [ "##关联推杆反应时间\n", "\n", "group_steps_base=pd.merge(group_steps_base,pushrod2_f_union,on=['change_flag','steps'],how='left')\n", "group_steps_base=pd.merge(group_steps_base,pushrod2_f_union,on=['change_flag','steps'],how='left')\n", "group_steps_base=pd.merge(group_steps_base,pushrod2_r_union,on=['change_flag','steps'],how='left')\n", "group_steps_base=pd.merge(group_steps_base,pushrod3_r_union,on=['change_flag','steps'],how='left')" ] }, { "cell_type": "code", "execution_count": 266, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
step_time_bstep_time_estep_timechange_flagstepsblock1_f_timeblock2_f_timeblock3_f_timeblock4_f_timeblock1_r_timeblock2_r_timeblock3_r_timeblock4_r_timepushrod2_f_time_xpushrod2_f_time_ypushrod2_r_timepushrod3_r_time
02023-06-10 00:18:36.0862023-06-10 00:18:46.98610.9244NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
12023-06-10 00:49:56.2862023-06-10 00:50:03.5867.341NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
22023-06-10 00:50:03.6862023-06-10 00:50:23.48619.842NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
32023-06-10 00:50:23.5862023-06-10 00:50:30.2866.743NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
42023-06-10 00:50:30.3862023-06-10 00:50:39.0868.744NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
......................................................
57812023-06-10 23:59:12.4862023-06-10 23:59:32.18619.72842NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
57822023-06-10 23:59:32.2862023-06-10 23:59:38.9866.72843NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
57832023-06-10 23:59:39.0862023-06-10 23:59:47.7868.72844NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
57842023-06-10 23:59:47.8862023-06-10 23:59:48.4860.628450.10.10.20.10.50.50.60.6NaNNaNNaNNaN
57852023-06-10 23:59:48.5862023-06-10 23:59:58.98610.42846NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", "

5786 rows × 17 columns

\n", "
" ], "text/plain": [ " step_time_b step_time_e step_time \\\n", "0 2023-06-10 00:18:36.086 2023-06-10 00:18:46.986 10.9 \n", "1 2023-06-10 00:49:56.286 2023-06-10 00:50:03.586 7.3 \n", "2 2023-06-10 00:50:03.686 2023-06-10 00:50:23.486 19.8 \n", "3 2023-06-10 00:50:23.586 2023-06-10 00:50:30.286 6.7 \n", "4 2023-06-10 00:50:30.386 2023-06-10 00:50:39.086 8.7 \n", "... ... ... ... \n", "5781 2023-06-10 23:59:12.486 2023-06-10 23:59:32.186 19.7 \n", "5782 2023-06-10 23:59:32.286 2023-06-10 23:59:38.986 6.7 \n", "5783 2023-06-10 23:59:39.086 2023-06-10 23:59:47.786 8.7 \n", "5784 2023-06-10 23:59:47.886 2023-06-10 23:59:48.486 0.6 \n", "5785 2023-06-10 23:59:48.586 2023-06-10 23:59:58.986 10.4 \n", "\n", " change_flag steps block1_f_time block2_f_time block3_f_time \\\n", "0 2 44 NaN NaN NaN \n", "1 4 1 NaN NaN NaN \n", "2 4 2 NaN NaN NaN \n", "3 4 3 NaN NaN NaN \n", "4 4 4 NaN NaN NaN \n", "... ... ... ... ... ... \n", "5781 284 2 NaN NaN NaN \n", "5782 284 3 NaN NaN NaN \n", "5783 284 4 NaN NaN NaN \n", "5784 284 5 0.1 0.1 0.2 \n", "5785 284 6 NaN NaN NaN \n", "\n", " block4_f_time block1_r_time block2_r_time block3_r_time \\\n", "0 NaN NaN NaN NaN \n", "1 NaN NaN NaN NaN \n", "2 NaN NaN NaN NaN \n", "3 NaN NaN NaN NaN \n", "4 NaN NaN NaN NaN \n", "... ... ... ... ... \n", "5781 NaN NaN NaN NaN \n", "5782 NaN NaN NaN NaN \n", "5783 NaN NaN NaN NaN \n", "5784 0.1 0.5 0.5 0.6 \n", "5785 NaN NaN NaN NaN \n", "\n", " block4_r_time pushrod2_f_time_x pushrod2_f_time_y pushrod2_r_time \\\n", "0 NaN NaN NaN NaN \n", "1 NaN NaN NaN NaN \n", "2 NaN NaN NaN NaN \n", "3 NaN NaN NaN NaN \n", "4 NaN NaN NaN NaN \n", "... ... ... ... ... \n", "5781 NaN NaN NaN NaN \n", "5782 NaN NaN NaN NaN \n", "5783 NaN NaN NaN NaN \n", "5784 0.6 NaN NaN NaN \n", "5785 NaN NaN NaN NaN \n", "\n", " pushrod3_r_time \n", "0 NaN \n", "1 NaN \n", "2 NaN \n", "3 NaN \n", "4 NaN \n", "... ... \n", "5781 NaN \n", "5782 NaN \n", "5783 NaN \n", "5784 NaN \n", "5785 NaN \n", "\n", "[5786 rows x 17 columns]" ] }, "execution_count": 266, "metadata": {}, "output_type": "execute_result" } ], "source": [ "group_steps_base" ] }, { "cell_type": "code", "execution_count": 227, "metadata": {}, "outputs": [], "source": [ "group_steps_base.to_csv(\"group_steps_base_10.csv\",index=False)" ] }, { "cell_type": "code", "execution_count": 267, "metadata": {}, "outputs": [], "source": [ "##关联故障码" ] }, { "cell_type": "code", "execution_count": 268, "metadata": {}, "outputs": [], "source": [ "group_steps_base=pd.merge(group_steps_base,error_code,on=['change_flag','steps'],how='left')" ] }, { "cell_type": "code", "execution_count": 269, "metadata": {}, "outputs": [], "source": [ "group_steps_base=pd.merge(group_steps_base,data_describe,on=['change_flag','steps'],how='left')" ] } ], "metadata": { "kernelspec": { "display_name": "py3916", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.16" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }