Browse Source

NumPy

pull/69/head
Jure Šorn 4 years ago
parent
commit
b400d44646
2 changed files with 4 additions and 4 deletions
  1. 4
      README.md
  2. 4
      index.html

4
README.md

@ -2587,7 +2587,7 @@ with PyCallGraph(drawer):
NumPy NumPy
----- -----
**Array manipulation mini-language. It can run up to one hundred times faster than the equivalent Python code.**
**Array manipulation mini-language. It can run up to one hundred times faster than the equivalent Python code. An even faster alternative that runs on a GPU is called CuPy.**
```python ```python
# $ pip3 install numpy # $ pip3 install numpy
@ -3404,7 +3404,7 @@ def wrangle_data(covid, dow, gold, bitcoin):
df = df.sort_index().interpolate() df = df.sort_index().interpolate()
df = df.rolling(10, min_periods=1, center=True).mean() df = df.rolling(10, min_periods=1, center=True).mean()
df = df.loc['2020-02-23':].iloc[:-2] df = df.loc['2020-02-23':].iloc[:-2]
df = df / df.iloc[0] * 100
df = (df / df.iloc[0]) * 100
return pd.concat([covid, df], axis=1, join='inner') return pd.concat([covid, df], axis=1, join='inner')
def display_data(df): def display_data(df):

4
index.html

@ -2235,7 +2235,7 @@ drawer = output.GraphvizOutput(output_file=filename)
</code></pre></div></div> </code></pre></div></div>
<div><h2 id="numpy"><a href="#numpy" name="numpy">#</a>NumPy</h2><p><strong>Array manipulation mini-language. It can run up to one hundred times faster than the equivalent Python code.</strong></p><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install numpy</span>
<div><h2 id="numpy"><a href="#numpy" name="numpy">#</a>NumPy</h2><p><strong>Array manipulation mini-language. It can run up to one hundred times faster than the equivalent Python code. An even faster alternative that runs on a GPU is called CuPy.</strong></p><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install numpy</span>
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np <span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
</code></pre></div> </code></pre></div>
@ -2888,7 +2888,7 @@ plotly.express.line(df, x=<span class="hljs-string">'Date'</span>, y=<span class
df = df.sort_index().interpolate() df = df.sort_index().interpolate()
df = df.rolling(<span class="hljs-number">10</span>, min_periods=<span class="hljs-number">1</span>, center=<span class="hljs-keyword">True</span>).mean() df = df.rolling(<span class="hljs-number">10</span>, min_periods=<span class="hljs-number">1</span>, center=<span class="hljs-keyword">True</span>).mean()
df = df.loc[<span class="hljs-string">'2020-02-23'</span>:].iloc[:<span class="hljs-number">-2</span>] df = df.loc[<span class="hljs-string">'2020-02-23'</span>:].iloc[:<span class="hljs-number">-2</span>]
df = df / df.iloc[<span class="hljs-number">0</span>] * <span class="hljs-number">100</span>
df = (df / df.iloc[<span class="hljs-number">0</span>]) * <span class="hljs-number">100</span>
<span class="hljs-keyword">return</span> pd.concat([covid, df], axis=<span class="hljs-number">1</span>, join=<span class="hljs-string">'inner'</span>) <span class="hljs-keyword">return</span> pd.concat([covid, df], axis=<span class="hljs-number">1</span>, join=<span class="hljs-string">'inner'</span>)
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">display_data</span><span class="hljs-params">(df)</span>:</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">display_data</span><span class="hljs-params">(df)</span>:</span>

Loading…
Cancel
Save