{"id":1111,"date":"2021-01-02T19:50:25","date_gmt":"2021-01-02T19:50:25","guid":{"rendered":"http:\/\/feellikelearning.com\/?p=1111"},"modified":"2021-01-04T04:13:25","modified_gmt":"2021-01-04T04:13:25","slug":"python-pandas-in-practice-process-ibkr-statement","status":"publish","type":"post","link":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/","title":{"rendered":"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement"},"content":{"rendered":"\n<p>Pandas\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u6570\u636e\u5206\u6790\u65b9\u9762\u7684Python package. \u5982\u679c\u662f\u505aMachine Learning\u6216\u8005\u6570\u636e\u5206\u6790, \u638c\u63e1Pandas\u5f88\u7701\u53bb\u5f88\u591a\u9ebb\u70e6. \u8bb8\u591aMachine Learning\u524d\u671f\u7684\u6570\u636e\u5904\u7406\u4e5f\u662f\u7528Pandas\u505a\u5f97. <\/p>\n\n\n\n<p>IBKR(Interactive Brokers, \u6709\u65f6\u7b80\u79f0IB, \u4e2d\u6587\u53eb\u76c8\u900f\u8bc1\u5238)\u662f\u7f8e\u56fd\u8001\u724c\u5238\u5546, \u4e5f\u662f\u6211\u7684\u4e3b\u8981\u4f7f\u7528\u7684\u5238\u5546. \u53c8\u5230\u4e86\u8f9e\u65e7\u8fce\u65b0\u7684\u65f6\u5019, \u9700\u8981\u770b\u770b2020\u6295\u8d44\u6536\u76ca, \u4e8e\u662f\u8d81\u65b0\u5e74\u957f\u5468\u672b\u5199\u70b9\u5c0f\u7a0b\u5e8f\u505a\u70b9\u6570\u636e\u5206\u6790. \u800c\u8fd9\u6b63\u597d\u8986\u76d6\u4e86Pandas\u7684\u5404\u79cd\u5e38\u7528functions. <\/p>\n\n\n\n<h2>\u4e0b\u8f7dIB Statement<\/h2>\n\n\n\n<p>IB Statement\u63d0\u4f9b\u591a\u79cd\u65b9\u5f0f\u4e0b\u8f7d, \u6bd4\u5982html, pdf, csv. \u7528\u4f5c\u6570\u636e\u5904\u7406\u9009csv. \u5185\u5bb9\u5927\u6982\u957f\u8fd9\u6837<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"2160\" height=\"892\" src=\"http:\/\/feellikelearning.com\/wp-content\/uploads\/2021\/01\/image.png\" alt=\"\" class=\"wp-image-1113\"\/><figcaption>IB statement\u4f8b\u5b50<\/figcaption><\/figure>\n\n\n\n<p>Statement\u8fd9\u4e2acolumn\u662f\u5185\u5bb9, \u91cc\u9762\u6709\u5f88\u591a\u9879, \u800c\u8fd9\u91cc\u6211\u53ea\u770b\u201cRealized &amp; Unrealized Performance Summary&#8221;, \u7136\u540e\u76f8\u540c\u7684\u7b2c\u4e00\u5217\u540e\u9762\u7684\u5217\u6570\u90fd\u662f\u4e00\u6837\u7684. \u4e0a\u56fe\u662fJupyter Lab\u7684\u663e\u793a\u6709\u95ee\u9898. \u56e0\u4e3a\u6587\u4ef6\u5176\u5b9e\u53ef\u4ee5\u770b\u6210\u5f88\u591aCSV files\u8fde\u5728\u4e00\u8d77, \u800c\u7b2c\u4e00\u5217\u53ef\u4ee5\u770b\u6210\u662f\u5c0fcsv\u7684\u6587\u4ef6\u540d. \u7136\u540e\u7b2c\u4e8c\u5217\u662fHeader\u6216\u8005Data. Header\u90a3\u884c\u5c31\u662f\u544a\u8bc9\u4f60\u540e\u9762\u7684Data\u884c\u91cc\u6bcf\u4e00\u5217\u90fd\u662f\u4ec0\u4e48. \u4e8e\u662f\u6211\u4eec\u53ef\u4ee5\u628a\u6570\u636e\u8bfb\u5230\u5185\u5b58\u91cc.<\/p>\n\n\n\n<h2>\u5efa\u7acbPandas DataFrame<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import pandas as pd\n\nfield = 'Realized &amp; Unrealized Performance Summary'\n\nf = open('statement.csv', 'r')\n\nrows = []\nfor line in f:\n    cols = line.strip().split(',')\n    if cols[0] == field:\n        if cols[1] == 'Header':\n            header_row = cols[2:]\n        else:\n            rows.append(cols[2:])<\/pre>\n\n\n\n<p>header_ros\u662f\u4e2alist of string<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">['Asset Category',\n 'Symbol',\n 'Cost Adj.',\n 'Realized S\/T Profit',\n 'Realized S\/T Loss',\n 'Realized L\/T Profit',\n 'Realized L\/T Loss',\n 'Realized Total',\n 'Unrealized S\/T Profit',\n 'Unrealized S\/T Loss',\n 'Unrealized L\/T Profit',\n 'Unrealized L\/T Loss',\n 'Unrealized Total',\n 'Total',\n 'Code']<\/pre>\n\n\n\n<p>\u800crows\u662flist of list. \u5c31\u662flist of rows<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[['Stocks',\n  'AAPL',\n  '0',\n  '0',\n  '0',\n  '0',\n  '0',\n  '0',\n  '29564.510608',\n  '-14.176325',\n  '0',\n  '0',\n  '29550.334283',\n  '29550.334283',\n  '\\n'],\n ['Stocks',\n  'AMD',\n  '0',\n  '0',\n  '0',\n  '0',\n  '0',\n  '0',\n  '220.208447',\n  '0',\n  '0',\n  '0',\n  '220.208447',\n  '220.208447',\n  '\\n'],\n...\n]<\/pre>\n\n\n\n<p>\u63a5\u4e0b\u6765\u5c31\u53ef\u4ee5\u7528Panda create dataframe\u4e86<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df = pd.DataFrame(rows, columns = header_row)\ndf.head(5)<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"2454\" height=\"472\" src=\"http:\/\/feellikelearning.com\/wp-content\/uploads\/2021\/01\/image-1.png\" alt=\"\" class=\"wp-image-1119\"\/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u6709\u4e2a\u95ee\u9898. Created\u51fa\u6765\u7684dataframe\u7684\u6570\u636e\u7c7b\u578b\u6709\u6570\u5b57\u6709string, \u5168\u90e8\u90fd\u662fobject. \u5982\u679csort by\u6570\u5b57column\u5f97\u5230\u7684\u7ed3\u679c\u662fsort by string, \u5e76\u4e0d\u662f\u6211\u4eec\u60f3\u8981\u7684. \u53ef\u4ee5\u7528dtypes\u6765\u786e\u5b9a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df.dtypes<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Asset Category           object\nSymbol                   object\nCost Adj.                object\nRealized S\/T Profit      object\nRealized S\/T Loss        object\nRealized L\/T Profit      object\nRealized L\/T Loss        object\nRealized Total           object\nUnrealized S\/T Profit    object\nUnrealized S\/T Loss      object\nUnrealized L\/T Profit    object\nUnrealized L\/T Loss      object\nUnrealized Total         object\nTotal                    object\nCode                     object\ndtype: object<\/pre>\n\n\n\n<p>\u8fd9\u91cc\u6211\u628a\u9700\u8981\u8f6c\u6362\u6210\u6570\u5b57\u7684columns\u8f6c\u6362\u4e86<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">header_text_col = set(['Asset Category', 'Symbol', 'Code'])\nnum_col = list(set(header_row) - header_text_col)\ndf[num_col] = df[num_col].apply(pd.to_numeric)\ndf.dtypes<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Asset Category            object\nSymbol                    object\nCost Adj.                  int64\nRealized S\/T Profit      float64\nRealized S\/T Loss        float64\nRealized L\/T Profit        int64\nRealized L\/T Loss        float64\nRealized Total           float64\nUnrealized S\/T Profit    float64\nUnrealized S\/T Loss      float64\nUnrealized L\/T Profit      int64\nUnrealized L\/T Loss      float64\nUnrealized Total         float64\nTotal                    float64\nCode                      object\ndtype: object<\/pre>\n\n\n\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u5bf9\u6570\u5b57\u7c7b\u578b\u7684column\u8fdb\u884c\u6392\u5e8f\u4e86, \u6bd4\u5982\u4e0b\u9762\u6307\u4ee4\u505a2\u6b65\u64cd\u4f5c<br>1. \u9009\u51faAsset Category\u662f&#8221;Stocks&#8221;\u7684rows, \u76f8\u5f53\u4e8eSQL\u91cc\u7684where, \u8bed\u6cd5\u4e3a<code>df[df['Asset Category'] == 'Stock']<\/code>, return\u662f\u53e6\u4e00\u4e2afiltered\u597d\u7684dataframe<br>2. \u6309Realized Total\u4ece\u5c0f\u5230\u5927\u6392\u5e8f, return\u4e5f\u662f\u53e6\u4e00\u6392\u5e8f\u597d\u7684dataframe<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df[df['Asset Category'] == 'Stock'].sort_values(by=['Realized Total'], ascending=True)<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"2460\" height=\"904\" src=\"http:\/\/feellikelearning.com\/wp-content\/uploads\/2021\/01\/image-2.png\" alt=\"\" class=\"wp-image-1123\"\/><\/figure>\n\n\n\n<p>\u8fd8\u53ef\u4ee5\u753b\u56fe<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">stock_gain = df[\n    (df['Asset Category'] == 'Stocks') &amp; (\n        df['Realized Total'] != 0.0)][['Symbol', 'Realized Total']].sort_values(\n    by=['Realized Total'], ascending=True)\nstock_gain<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"476\" height=\"1044\" src=\"http:\/\/feellikelearning.com\/wp-content\/uploads\/2021\/01\/image-7.png\" alt=\"\" class=\"wp-image-1158\"\/><\/figure>\n\n\n\n<p>\u8fd8\u53ef\u4ee5\u753b\u56fe<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">stock_gain.plot.bar(x='Symbol')<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"992\" height=\"734\" src=\"http:\/\/feellikelearning.com\/wp-content\/uploads\/2021\/01\/image-8.png\" alt=\"\" class=\"wp-image-1159\"\/><\/figure>\n\n\n\n<h2>\u6280\u672f\u5c0f\u7ed3<\/h2>\n\n\n\n<h3>\u5efa\u7acbdataframe<\/h3>\n\n\n\n<p>rows\u662flist of rows(lists), header_row\u662flist of string<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df = pd.DataFrame(rows, columns = header_row)<\/pre>\n\n\n\n<h3>\u663e\u793a\u524dn\u884c<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df.head(10)<\/pre>\n\n\n\n<h3>\u663e\u793a\u540e\u9762n\u884c<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df.tail(10)<\/pre>\n\n\n\n<h3>\u628a\u7279\u5b9acolumns\u8f6c\u6362\u6210\u6570\u5b57(numerical type)<\/h3>\n\n\n\n<p>num_col\u662flist of strings, \u4e0b\u9762\u547d\u4ee4\u4f1a\u628anum_col\u91cc\u7684columns\u90fd\u8f6c\u5316\u6210\u6570\u5b57\u7c7b. \u7c7b\u4f3cSQL\u91cc\u7684<code>select cast(col1 as double), cast(col2 as double), ... from df<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df[num_col] = df[num_col].apply(pd.to_numeric)<\/pre>\n\n\n\n<h3>Filter\u548csort<\/h3>\n\n\n\n<p>\u7c7b\u4f3cSQL\u91cc, <code>select * from df where asset_category = 'Stocks' order by realized_total asc;<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df[df['Asset Category'] == 'Stocks'].sort_values(by=['Realized Total'], ascending=True)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Pandas\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u6570\u636e\u5206\u6790\u65b9\u9762\u7684Python package. \u5982\u679c\u662f\u505aMachine Learning\u6216\u8005\u6570\u636e\u5206\u6790, \u638c\u63e1Pandas\u5f88\u7701\u53bb\u5f88\u591a\u9ebb\u70e6. \u8bb8\u591aMachine Learning\u524d\u671f\u7684\u6570\u636e\u5904\u7406\u4e5f\u662f\u7528Pandas\u505a\u5f97. IBKR(Interactive Brokers, \u6709\u65f6\u7b80\u79f0IB, \u4e2d\u6587\u53eb\u76c8\u900f\u8bc1\u5238)\u662f\u7f8e\u56fd\u8001\u724c\u5238\u5546, \u4e5f\u662f\u6211\u7684\u4e3b\u8981\u4f7f\u7528\u7684\u5238\u5546. \u53c8\u5230\u4e86\u8f9e\u65e7\u8fce\u65b0\u7684\u65f6\u5019, \u9700\u8981\u770b\u770b2020\u6295\u8d44\u6536\u76ca, \u4e8e\u662f\u8d81\u65b0\u5e74\u957f\u5468\u672b\u5199\u70b9\u5c0f\u7a0b\u5e8f\u505a\u70b9\u6570\u636e\u5206\u6790. \u800c\u8fd9\u6b63\u597d\u8986\u76d6\u4e86Pandas\u7684\u5404\u79cd\u5e38\u7528functions. \u4e0b\u8f7dIB Statement IB Statement\u63d0\u4f9b\u591a\u79cd\u65b9\u5f0f\u4e0b\u8f7d, \u6bd4\u5982html, pdf, csv. \u7528\u4f5c\u6570\u636e\u5904\u7406\u9009csv. \u5185\u5bb9\u5927\u6982\u957f\u8fd9\u6837 Statement\u8fd9\u4e2acolumn\u662f\u5185\u5bb9, \u91cc\u9762\u6709\u5f88\u591a\u9879, \u800c\u8fd9\u91cc\u6211\u53ea\u770b\u201cRealized &amp; Unrealized Performance Summary&#8221;, \u7136\u540e\u76f8\u540c\u7684\u7b2c\u4e00\u5217\u540e\u9762\u7684\u5217\u6570\u90fd\u662f\u4e00\u6837\u7684. \u4e0a\u56fe\u662fJupyter Lab\u7684\u663e\u793a\u6709\u95ee\u9898. \u56e0\u4e3a\u6587\u4ef6\u5176\u5b9e\u53ef\u4ee5\u770b\u6210\u5f88\u591aCSV files\u8fde\u5728\u4e00\u8d77, \u800c\u7b2c\u4e00\u5217\u53ef\u4ee5\u770b\u6210\u662f\u5c0fcsv\u7684\u6587\u4ef6\u540d. \u7136\u540e\u7b2c\u4e8c\u5217\u662fHeader\u6216\u8005Data. Header\u90a3\u884c\u5c31\u662f\u544a\u8bc9\u4f60\u540e\u9762\u7684Data\u884c\u91cc\u6bcf\u4e00\u5217\u90fd\u662f\u4ec0\u4e48&#8230;.<br \/><a class=\"read-more-button\" href=\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":1133,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[23,10],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.10 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement | Feel Like Learning<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement | Feel Like Learning\" \/>\n<meta property=\"og:description\" content=\"Pandas\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u6570\u636e\u5206\u6790\u65b9\u9762\u7684Python package. \u5982\u679c\u662f\u505aMachine Learning\u6216\u8005\u6570\u636e\u5206\u6790, \u638c\u63e1Pandas\u5f88\u7701\u53bb\u5f88\u591a\u9ebb\u70e6. \u8bb8\u591aMachine Learning\u524d\u671f\u7684\u6570\u636e\u5904\u7406\u4e5f\u662f\u7528Pandas\u505a\u5f97. IBKR(Interactive Brokers, \u6709\u65f6\u7b80\u79f0IB, \u4e2d\u6587\u53eb\u76c8\u900f\u8bc1\u5238)\u662f\u7f8e\u56fd\u8001\u724c\u5238\u5546, \u4e5f\u662f\u6211\u7684\u4e3b\u8981\u4f7f\u7528\u7684\u5238\u5546. \u53c8\u5230\u4e86\u8f9e\u65e7\u8fce\u65b0\u7684\u65f6\u5019, \u9700\u8981\u770b\u770b2020\u6295\u8d44\u6536\u76ca, \u4e8e\u662f\u8d81\u65b0\u5e74\u957f\u5468\u672b\u5199\u70b9\u5c0f\u7a0b\u5e8f\u505a\u70b9\u6570\u636e\u5206\u6790. \u800c\u8fd9\u6b63\u597d\u8986\u76d6\u4e86Pandas\u7684\u5404\u79cd\u5e38\u7528functions. \u4e0b\u8f7dIB Statement IB Statement\u63d0\u4f9b\u591a\u79cd\u65b9\u5f0f\u4e0b\u8f7d, \u6bd4\u5982html, pdf, csv. \u7528\u4f5c\u6570\u636e\u5904\u7406\u9009csv. \u5185\u5bb9\u5927\u6982\u957f\u8fd9\u6837 Statement\u8fd9\u4e2acolumn\u662f\u5185\u5bb9, \u91cc\u9762\u6709\u5f88\u591a\u9879, \u800c\u8fd9\u91cc\u6211\u53ea\u770b\u201cRealized &amp; Unrealized Performance Summary&#8221;, \u7136\u540e\u76f8\u540c\u7684\u7b2c\u4e00\u5217\u540e\u9762\u7684\u5217\u6570\u90fd\u662f\u4e00\u6837\u7684. \u4e0a\u56fe\u662fJupyter Lab\u7684\u663e\u793a\u6709\u95ee\u9898. \u56e0\u4e3a\u6587\u4ef6\u5176\u5b9e\u53ef\u4ee5\u770b\u6210\u5f88\u591aCSV files\u8fde\u5728\u4e00\u8d77, \u800c\u7b2c\u4e00\u5217\u53ef\u4ee5\u770b\u6210\u662f\u5c0fcsv\u7684\u6587\u4ef6\u540d. \u7136\u540e\u7b2c\u4e8c\u5217\u662fHeader\u6216\u8005Data. Header\u90a3\u884c\u5c31\u662f\u544a\u8bc9\u4f60\u540e\u9762\u7684Data\u884c\u91cc\u6bcf\u4e00\u5217\u90fd\u662f\u4ec0\u4e48....Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant\" \/>\n<meta property=\"og:site_name\" content=\"Feel Like Learning\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-02T19:50:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-04T04:13:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/feellikelearning.com\/wp-content\/uploads\/2021\/01\/blog-covers.035.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"feellikelearning\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Python\/Pandas\u5b9e\u6218: \u5904\u7406\u76c8\u900fStatement\" \/>\n<meta name=\"twitter:description\" content=\"Python\/Pandas\u5b9e\u6218: \u5904\u7406\u76c8\u900fStatement\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/feellikelearning.com\/wp-content\/uploads\/2021\/01\/blog-covers.035.jpeg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"feellikelearning\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant#article\",\"isPartOf\":{\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant\"},\"author\":{\"name\":\"feellikelearning\",\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\"},\"headline\":\"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement\",\"datePublished\":\"2021-01-02T19:50:25+00:00\",\"dateModified\":\"2021-01-04T04:13:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant\"},\"wordCount\":116,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\"},\"articleSection\":[\"pandas\",\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant\",\"url\":\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant\",\"name\":\"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement | Feel Like Learning\",\"isPartOf\":{\"@id\":\"https:\/\/feellikelearning.com\/#website\"},\"datePublished\":\"2021-01-02T19:50:25+00:00\",\"dateModified\":\"2021-01-04T04:13:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/feellikelearning.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/feellikelearning.com\/#website\",\"url\":\"https:\/\/feellikelearning.com\/\",\"name\":\"Feel Like Learning\",\"description\":\"\u7a0b\u5e8f\uff5c\u751f\u6d3b\uff5c\u5b66\u5230\u5c31\u662f\u8d5a\u5230\",\"publisher\":{\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/feellikelearning.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\",\"name\":\"feellikelearning\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g\",\"caption\":\"feellikelearning\"},\"logo\":{\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/feellikelearning.com\/index.php\/author\/feellikelearning\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement | Feel Like Learning","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant","og_locale":"en_US","og_type":"article","og_title":"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement | Feel Like Learning","og_description":"Pandas\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u6570\u636e\u5206\u6790\u65b9\u9762\u7684Python package. \u5982\u679c\u662f\u505aMachine Learning\u6216\u8005\u6570\u636e\u5206\u6790, \u638c\u63e1Pandas\u5f88\u7701\u53bb\u5f88\u591a\u9ebb\u70e6. \u8bb8\u591aMachine Learning\u524d\u671f\u7684\u6570\u636e\u5904\u7406\u4e5f\u662f\u7528Pandas\u505a\u5f97. IBKR(Interactive Brokers, \u6709\u65f6\u7b80\u79f0IB, \u4e2d\u6587\u53eb\u76c8\u900f\u8bc1\u5238)\u662f\u7f8e\u56fd\u8001\u724c\u5238\u5546, \u4e5f\u662f\u6211\u7684\u4e3b\u8981\u4f7f\u7528\u7684\u5238\u5546. \u53c8\u5230\u4e86\u8f9e\u65e7\u8fce\u65b0\u7684\u65f6\u5019, \u9700\u8981\u770b\u770b2020\u6295\u8d44\u6536\u76ca, \u4e8e\u662f\u8d81\u65b0\u5e74\u957f\u5468\u672b\u5199\u70b9\u5c0f\u7a0b\u5e8f\u505a\u70b9\u6570\u636e\u5206\u6790. \u800c\u8fd9\u6b63\u597d\u8986\u76d6\u4e86Pandas\u7684\u5404\u79cd\u5e38\u7528functions. \u4e0b\u8f7dIB Statement IB Statement\u63d0\u4f9b\u591a\u79cd\u65b9\u5f0f\u4e0b\u8f7d, \u6bd4\u5982html, pdf, csv. \u7528\u4f5c\u6570\u636e\u5904\u7406\u9009csv. \u5185\u5bb9\u5927\u6982\u957f\u8fd9\u6837 Statement\u8fd9\u4e2acolumn\u662f\u5185\u5bb9, \u91cc\u9762\u6709\u5f88\u591a\u9879, \u800c\u8fd9\u91cc\u6211\u53ea\u770b\u201cRealized &amp; Unrealized Performance Summary&#8221;, \u7136\u540e\u76f8\u540c\u7684\u7b2c\u4e00\u5217\u540e\u9762\u7684\u5217\u6570\u90fd\u662f\u4e00\u6837\u7684. \u4e0a\u56fe\u662fJupyter Lab\u7684\u663e\u793a\u6709\u95ee\u9898. \u56e0\u4e3a\u6587\u4ef6\u5176\u5b9e\u53ef\u4ee5\u770b\u6210\u5f88\u591aCSV files\u8fde\u5728\u4e00\u8d77, \u800c\u7b2c\u4e00\u5217\u53ef\u4ee5\u770b\u6210\u662f\u5c0fcsv\u7684\u6587\u4ef6\u540d. \u7136\u540e\u7b2c\u4e8c\u5217\u662fHeader\u6216\u8005Data. Header\u90a3\u884c\u5c31\u662f\u544a\u8bc9\u4f60\u540e\u9762\u7684Data\u884c\u91cc\u6bcf\u4e00\u5217\u90fd\u662f\u4ec0\u4e48....Read more","og_url":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant","og_site_name":"Feel Like Learning","article_published_time":"2021-01-02T19:50:25+00:00","article_modified_time":"2021-01-04T04:13:25+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/feellikelearning.com\/wp-content\/uploads\/2021\/01\/blog-covers.035.jpeg","type":"image\/jpeg"}],"author":"feellikelearning","twitter_card":"summary_large_image","twitter_title":"Python\/Pandas\u5b9e\u6218: \u5904\u7406\u76c8\u900fStatement","twitter_description":"Python\/Pandas\u5b9e\u6218: \u5904\u7406\u76c8\u900fStatement","twitter_image":"https:\/\/feellikelearning.com\/wp-content\/uploads\/2021\/01\/blog-covers.035.jpeg","twitter_misc":{"Written by":"feellikelearning","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant#article","isPartOf":{"@id":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant"},"author":{"name":"feellikelearning","@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a"},"headline":"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement","datePublished":"2021-01-02T19:50:25+00:00","dateModified":"2021-01-04T04:13:25+00:00","mainEntityOfPage":{"@id":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant"},"wordCount":116,"commentCount":0,"publisher":{"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a"},"articleSection":["pandas","Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant#respond"]}]},{"@type":"WebPage","@id":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant","url":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant","name":"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement | Feel Like Learning","isPartOf":{"@id":"https:\/\/feellikelearning.com\/#website"},"datePublished":"2021-01-02T19:50:25+00:00","dateModified":"2021-01-04T04:13:25+00:00","breadcrumb":{"@id":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/feellikelearning.com\/index.php\/2021\/01\/02\/python-pandas-in-practice-process-ibkr-statement\/?variant=zh-hant#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/feellikelearning.com\/"},{"@type":"ListItem","position":2,"name":"Python\/Pandas\u5b9e\u6218: \u5904\u7406IBKR Statement"}]},{"@type":"WebSite","@id":"https:\/\/feellikelearning.com\/#website","url":"https:\/\/feellikelearning.com\/","name":"Feel Like Learning","description":"\u7a0b\u5e8f\uff5c\u751f\u6d3b\uff5c\u5b66\u5230\u5c31\u662f\u8d5a\u5230","publisher":{"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/feellikelearning.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a","name":"feellikelearning","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g","caption":"feellikelearning"},"logo":{"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/"},"url":"https:\/\/feellikelearning.com\/index.php\/author\/feellikelearning\/"}]}},"_links":{"self":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts\/1111"}],"collection":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/comments?post=1111"}],"version-history":[{"count":21,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts\/1111\/revisions"}],"predecessor-version":[{"id":1164,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts\/1111\/revisions\/1164"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/media\/1133"}],"wp:attachment":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/media?parent=1111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/categories?post=1111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/tags?post=1111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}