Skip to content

Commit

Permalink
fix pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
luweizheng committed Sep 23, 2023
1 parent 7283de3 commit 549071d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
9 changes: 5 additions & 4 deletions docs/_sources/ch-pandas/dataframe-groupby.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
"iopub.status.busy": "2023-09-18T00:08:11.016110Z",
"iopub.status.idle": "2023-09-18T00:08:11.605146Z",
"shell.execute_reply": "2023-09-18T00:08:11.604394Z"
}
},
"tags": [
"hide-cell"
]
},
"outputs": [
{
Expand All @@ -41,14 +44,12 @@
}
],
"source": [
"# Hide outputs\n",
"# Hide code\n",
"import os\n",
"import urllib.request\n",
"import zipfile\n",
"import pandas as pd\n",
"\n",
"folder_path = os.path.join(os.getcwd(), \"./data/pwt\")\n",
"folder_path = os.path.join(os.getcwd(), \"../data/pwt\")\n",
"download_url = \"https://www.rug.nl/ggdc/docs/pwt70_06032011version.zip\"\n",
"file_name = download_url.split(\"/\")[-1]\n",
"if not os.path.exists(folder_path):\n",
Expand Down
20 changes: 12 additions & 8 deletions docs/ch-pandas/dataframe-groupby.html
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,19 @@ <h1>分组汇总<a class="headerlink" href="#id1" title="Permalink to this headi
<div class="figure align-default" id="groupby-img">
<img alt="../_images/groupby.svg" src="../_images/groupby.svg" /><p class="caption"><span class="caption-number">Fig. 1 </span><span class="caption-text">分组与汇总</span><a class="headerlink" href="#groupby-img" title="Permalink to this image">#</a></p>
</div>
<div class="cell docutils container">
<div class="cell tag_hide-cell docutils container">
<details class="hide above-input">
<summary aria-label="Toggle hidden content">
<span class="collapsed">Show code cell content</span>
<span class="expanded">Hide code cell content</span>
</summary>
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Hide outputs</span>
<span class="c1"># Hide code</span>
<span class="kn">import</span> <span class="nn">os</span>
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">urllib.request</span>
<span class="kn">import</span> <span class="nn">zipfile</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>

<span class="n">folder_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">(),</span> <span class="s2">&quot;./data/pwt&quot;</span><span class="p">)</span>
<span class="n">folder_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">(),</span> <span class="s2">&quot;../data/pwt&quot;</span><span class="p">)</span>
<span class="n">download_url</span> <span class="o">=</span> <span class="s2">&quot;https://www.rug.nl/ggdc/docs/pwt70_06032011version.zip&quot;</span>
<span class="n">file_name</span> <span class="o">=</span> <span class="n">download_url</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">folder_path</span><span class="p">):</span>
Expand All @@ -432,6 +435,7 @@ <h1>分组汇总<a class="headerlink" href="#id1" title="Permalink to this headi
</pre></div>
</div>
</div>
</details>
</div>
<div class="section" id="id2">
<h2>分组变量<a class="headerlink" href="#id2" title="Permalink to this heading">#</a></h2>
Expand Down Expand Up @@ -536,7 +540,7 @@ <h2>汇总变量<a class="headerlink" href="#id3" title="Permalink to this headi
</div>
</div>
<div class="cell_output docutils container">
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/4n/v40br47s46ggrjm9bdm64lwh0000gn/T/ipykernel_92515/459214562.py:1: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/4n/v40br47s46ggrjm9bdm64lwh0000gn/T/ipykernel_33069/459214562.py:1: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
df.groupby([&#39;year&#39;])[&#39;tcgdp&#39;,&#39;POP&#39;].mean()
</pre></div>
</div>
Expand Down Expand Up @@ -1009,7 +1013,7 @@ <h2>多重索引<a class="headerlink" href="#id5" title="Permalink to this headi
</div>
</div>
<div class="cell_output docutils container">
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/4n/v40br47s46ggrjm9bdm64lwh0000gn/T/ipykernel_92515/1148587731.py:1: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/4n/v40br47s46ggrjm9bdm64lwh0000gn/T/ipykernel_33069/1148587731.py:1: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
df.groupby([&#39;country&#39;,&#39;year&#39;])[&#39;tcgdp&#39;,&#39;POP&#39;].agg([&#39;min&#39;,&#39;max&#39;])
</pre></div>
</div>
Expand Down Expand Up @@ -1152,7 +1156,7 @@ <h2>多重索引<a class="headerlink" href="#id5" title="Permalink to this headi
</div>
</div>
<div class="cell_output docutils container">
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/4n/v40br47s46ggrjm9bdm64lwh0000gn/T/ipykernel_92515/1120076566.py:1: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/4n/v40br47s46ggrjm9bdm64lwh0000gn/T/ipykernel_33069/1120076566.py:1: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
df_query = df.groupby([&#39;country&#39;,&#39;year&#39;])[&#39;tcgdp&#39;,&#39;POP&#39;].agg([&#39;min&#39;,&#39;max&#39;])
</pre></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

0 comments on commit 549071d

Please sign in to comment.