Browse Source

Memoryview, Plotly

pull/135/merge
Jure Šorn 2 months ago
parent
commit
e2ab4c9997
2 changed files with 4 additions and 4 deletions
  1. 4
      README.md
  2. 4
      index.html

4
README.md

@ -2078,7 +2078,7 @@ Memory View
```
```python
<list> = list(<mview>) # Returns a list of ints, floats or bytes.
<list> = list(<mview>) # Returns a list of ints, floats, or bytes.
<str> = str(<mview>, 'utf-8') # Treats memoryview as a bytes object.
<str> = <mview>.hex() # Returns hex pairs. Accepts `sep=<str>`.
```
@ -3482,7 +3482,7 @@ def scrape_data():
def wrangle_data(covid, bitcoin, gold, dow):
df = pd.concat([bitcoin, gold, dow], axis=1) # Creates table by joining columns on dates.
df = df.sort_index().interpolate() # Sorts table by date and interpolates NaN-s.
df = df.sort_index().interpolate() # Sorts rows by date and interpolates NaN-s.
df = df.loc['2020-02-23':] # Discards rows before '2020-02-23'.
df = (df / df.iloc[0]) * 100 # Calculates percentages relative to day 1.
df = df.join(covid) # Adds column with covid cases.

4
index.html

@ -1710,7 +1710,7 @@ CompletedProcess(args=[<span class="hljs-string">'bc'</span>, <span class="hljs-
&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;mview&gt;) <span class="hljs-comment"># Treats memoryview as a sequence of numbers.</span>
&lt;file&gt;.write(&lt;mview&gt;) <span class="hljs-comment"># Writes `bytes(&lt;mview&gt;)` to the binary file.</span>
</code></pre>
<pre><code class="python language-python hljs">&lt;list&gt; = list(&lt;mview&gt;) <span class="hljs-comment"># Returns a list of ints, floats or bytes.</span>
<pre><code class="python language-python hljs">&lt;list&gt; = list(&lt;mview&gt;) <span class="hljs-comment"># Returns a list of ints, floats, or bytes.</span>
&lt;str&gt; = str(&lt;mview&gt;, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Treats memoryview as a bytes object.</span>
&lt;str&gt; = &lt;mview&gt;.hex() <span class="hljs-comment"># Returns hex pairs. Accepts `sep=&lt;str&gt;`.</span>
</code></pre>
@ -2829,7 +2829,7 @@ px.line(df, x=<span class="hljs-string">'Date'</span>, y=<span class="hljs-strin
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">wrangle_data</span><span class="hljs-params">(covid, bitcoin, gold, dow)</span>:</span>
df = pd.concat([bitcoin, gold, dow], axis=<span class="hljs-number">1</span>) <span class="hljs-comment"># Creates table by joining columns on dates.</span>
df = df.sort_index().interpolate() <span class="hljs-comment"># Sorts table by date and interpolates NaN-s.</span>
df = df.sort_index().interpolate() <span class="hljs-comment"># Sorts rows by date and interpolates NaN-s.</span>
df = df.loc[<span class="hljs-string">'2020-02-23'</span>:] <span class="hljs-comment"># Discards rows before '2020-02-23'.</span>
df = (df / df.iloc[<span class="hljs-number">0</span>]) * <span class="hljs-number">100</span> <span class="hljs-comment"># Calculates percentages relative to day 1.</span>
df = df.join(covid) <span class="hljs-comment"># Adds column with covid cases.</span>

Loading…
Cancel
Save