From e47b2e5fe9fd04f35195797b26f2bf3b58abfd20 Mon Sep 17 00:00:00 2001 From: 100gle <569590461@qq.com> Date: Sun, 17 Jul 2022 10:20:29 +0800 Subject: [PATCH] =?UTF-8?q?bugfix(vol10):=20=E4=BF=AE=E5=A4=8Dto=5Fdatetim?= =?UTF-8?q?e=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E6=95=B0=E5=80=BC=E6=97=A5=E6=9C=9F=E8=A1=A8=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/10/series.ipynb | 179 +++++++++++++++++++++++-------------------- 1 file changed, 96 insertions(+), 83 deletions(-) diff --git a/code/10/series.ipynb b/code/10/series.ipynb index 62ae025..fb365f2 100644 --- a/code/10/series.ipynb +++ b/code/10/series.ipynb @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 148, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -41,7 +41,7 @@ }, { "cell_type": "code", - "execution_count": 149, + "execution_count": 2, "metadata": { "collapsed": false, "pycharm": { @@ -63,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 150, + "execution_count": 3, "metadata": { "collapsed": false, "pycharm": { @@ -105,7 +105,7 @@ }, { "cell_type": "code", - "execution_count": 151, + "execution_count": 4, "metadata": { "collapsed": false, "pycharm": { @@ -124,7 +124,7 @@ "Name: numbers, dtype: int64" ] }, - "execution_count": 151, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -143,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 152, + "execution_count": 5, "metadata": { "collapsed": false, "pycharm": { @@ -157,7 +157,7 @@ "RangeIndex(start=0, stop=100, step=1)" ] }, - "execution_count": 152, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -168,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 153, + "execution_count": 6, "metadata": { "collapsed": false, "pycharm": { @@ -190,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": 154, + "execution_count": 7, "metadata": { "collapsed": false, "pycharm": { @@ -204,7 +204,7 @@ "dtype('int64')" ] }, - "execution_count": 154, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -215,7 +215,7 @@ }, { "cell_type": "code", - "execution_count": 155, + "execution_count": 8, "metadata": { "collapsed": false, "pycharm": { @@ -229,7 +229,7 @@ "(100,)" ] }, - "execution_count": 155, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -240,7 +240,7 @@ }, { "cell_type": "code", - "execution_count": 156, + "execution_count": 9, "metadata": { "collapsed": false, "pycharm": { @@ -254,7 +254,7 @@ "100" ] }, - "execution_count": 156, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -265,7 +265,7 @@ }, { "cell_type": "code", - "execution_count": 157, + "execution_count": 10, "metadata": { "collapsed": false, "pycharm": { @@ -279,7 +279,7 @@ "'numbers'" ] }, - "execution_count": 157, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -290,7 +290,7 @@ }, { "cell_type": "code", - "execution_count": 158, + "execution_count": 11, "metadata": { "collapsed": false, "pycharm": { @@ -309,7 +309,7 @@ " 5, 31, 23, 25, 9, 41, 29, 23, 20, 39, 48, 47, 9, 14, 32])" ] }, - "execution_count": 158, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -332,7 +332,7 @@ }, { "cell_type": "code", - "execution_count": 159, + "execution_count": 12, "metadata": { "collapsed": false, "pycharm": { @@ -354,7 +354,7 @@ }, { "cell_type": "code", - "execution_count": 160, + "execution_count": 13, "metadata": { "collapsed": false, "pycharm": { @@ -379,7 +379,7 @@ "Length: 100, dtype: int64" ] }, - "execution_count": 160, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -390,7 +390,7 @@ }, { "cell_type": "code", - "execution_count": 161, + "execution_count": 14, "metadata": { "collapsed": false, "pycharm": { @@ -415,7 +415,7 @@ "Length: 100, dtype: int64" ] }, - "execution_count": 161, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -426,7 +426,7 @@ }, { "cell_type": "code", - "execution_count": 162, + "execution_count": 15, "metadata": { "collapsed": false, "pycharm": { @@ -451,7 +451,7 @@ "Length: 100, dtype: int64" ] }, - "execution_count": 162, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -462,7 +462,7 @@ }, { "cell_type": "code", - "execution_count": 163, + "execution_count": 16, "metadata": { "collapsed": false, "pycharm": { @@ -487,7 +487,7 @@ "Length: 100, dtype: float64" ] }, - "execution_count": 163, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -498,7 +498,7 @@ }, { "cell_type": "code", - "execution_count": 164, + "execution_count": 17, "metadata": { "collapsed": false, "pycharm": { @@ -512,7 +512,7 @@ "49" ] }, - "execution_count": 164, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -523,7 +523,7 @@ }, { "cell_type": "code", - "execution_count": 165, + "execution_count": 18, "metadata": { "collapsed": false, "pycharm": { @@ -537,7 +537,7 @@ "1" ] }, - "execution_count": 165, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -548,7 +548,7 @@ }, { "cell_type": "code", - "execution_count": 166, + "execution_count": 19, "metadata": { "collapsed": false, "pycharm": { @@ -562,7 +562,7 @@ "25.5" ] }, - "execution_count": 166, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -573,7 +573,7 @@ }, { "cell_type": "code", - "execution_count": 167, + "execution_count": 20, "metadata": { "collapsed": false, "pycharm": { @@ -587,7 +587,7 @@ "25.51" ] }, - "execution_count": 167, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -598,7 +598,7 @@ }, { "cell_type": "code", - "execution_count": 168, + "execution_count": 21, "metadata": { "collapsed": false, "pycharm": { @@ -612,7 +612,7 @@ "14.990566056926294" ] }, - "execution_count": 168, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -630,7 +630,7 @@ }, { "cell_type": "code", - "execution_count": 169, + "execution_count": 22, "metadata": { "collapsed": false, "pycharm": { @@ -649,7 +649,7 @@ "Name: numbers, dtype: bool" ] }, - "execution_count": 169, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -667,7 +667,7 @@ }, { "cell_type": "code", - "execution_count": 170, + "execution_count": 23, "metadata": { "collapsed": false, "pycharm": { @@ -686,7 +686,7 @@ "Name: numbers, dtype: int64" ] }, - "execution_count": 170, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -697,7 +697,7 @@ }, { "cell_type": "code", - "execution_count": 171, + "execution_count": 24, "metadata": { "collapsed": false, "pycharm": { @@ -716,7 +716,7 @@ "Name: numbers, dtype: bool" ] }, - "execution_count": 171, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -728,7 +728,7 @@ }, { "cell_type": "code", - "execution_count": 172, + "execution_count": 25, "metadata": { "collapsed": false, "pycharm": { @@ -747,7 +747,7 @@ "Name: numbers, dtype: int64" ] }, - "execution_count": 172, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -770,7 +770,7 @@ }, { "cell_type": "code", - "execution_count": 173, + "execution_count": 26, "metadata": { "collapsed": false, "pycharm": { @@ -784,7 +784,7 @@ }, { "cell_type": "code", - "execution_count": 174, + "execution_count": 27, "metadata": { "collapsed": false, "pycharm": { @@ -802,7 +802,7 @@ "Name: fruit, dtype: int64" ] }, - "execution_count": 174, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -813,7 +813,7 @@ }, { "cell_type": "code", - "execution_count": 175, + "execution_count": 28, "metadata": { "collapsed": false, "pycharm": { @@ -831,7 +831,7 @@ "Name: fruit, dtype: int64" ] }, - "execution_count": 175, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -842,7 +842,7 @@ }, { "cell_type": "code", - "execution_count": 176, + "execution_count": 29, "metadata": { "collapsed": false, "pycharm": { @@ -850,6 +850,14 @@ } }, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/var/folders/0t/s0c95rbs6ds7w_b0d471p0kc0000gn/T/ipykernel_83159/772644344.py:1: FutureWarning: The default value of regex will change from True to False in a future version.\n", + " str_series.str.replace(\"[p]{2}\", \"XX\")\n" + ] + }, { "data": { "text/plain": [ @@ -860,7 +868,7 @@ "Name: fruit, dtype: object" ] }, - "execution_count": 176, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -871,7 +879,7 @@ }, { "cell_type": "code", - "execution_count": 177, + "execution_count": 30, "metadata": { "collapsed": false, "pycharm": { @@ -880,13 +888,13 @@ }, "outputs": [], "source": [ - "dt_series = pd.Series([20220101, 20220201, 20220301, 20220401], name=\"date\")\n", + "dt_series = pd.Series([20220101, 20220201, 20220301, 20220401], name=\"date\").astype(\"string\")\n", "dt_series = pd.to_datetime(dt_series, format=\"%Y-%m-%d\")" ] }, { "cell_type": "code", - "execution_count": 178, + "execution_count": 31, "metadata": { "collapsed": false, "pycharm": { @@ -900,7 +908,7 @@ "dtype('