Skip to content

Commit

Permalink
Deploying to gh-pages from @ bc2697f 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed May 20, 2024
1 parent 6567c90 commit a7d2943
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
30 changes: 21 additions & 9 deletions _modules/arkouda/util.html
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ <h1>Source code for arkouda.util</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">arkouda.timeclass</span> <span class="kn">import</span> <span class="n">Datetime</span><span class="p">,</span> <span class="n">Timedelta</span>

<span class="k">if</span> <span class="n">TYPE_CHECKING</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">arkouda.index</span> <span class="kn">import</span> <span class="n">Index</span>
<span class="kn">from</span> <span class="nn">arkouda.series</span> <span class="kn">import</span> <span class="n">Series</span>


Expand Down Expand Up @@ -834,7 +835,9 @@ <h1>Source code for arkouda.util</h1><div class="highlight"><pre>

<div class="viewcode-block" id="is_numeric">
<a class="viewcode-back" href="../../autoapi/arkouda/util/index.html#arkouda.is_numeric">[docs]</a>
<span class="k">def</span> <span class="nf">is_numeric</span><span class="p">(</span><span class="n">arry</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">pdarray</span><span class="p">,</span> <span class="n">Strings</span><span class="p">,</span> <span class="n">Categorical</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="n">builtins</span><span class="o">.</span><span class="n">bool</span><span class="p">:</span> <span class="c1"># noqa: F821</span>
<span class="k">def</span> <span class="nf">is_numeric</span><span class="p">(</span>
<span class="n">arry</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">pdarray</span><span class="p">,</span> <span class="n">Strings</span><span class="p">,</span> <span class="n">Categorical</span><span class="p">,</span> <span class="s2">&quot;Series&quot;</span><span class="p">,</span> <span class="s2">&quot;Index&quot;</span><span class="p">]</span> <span class="c1"># noqa: F821</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">builtins</span><span class="o">.</span><span class="n">bool</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Check if the dtype of the given array is numeric.</span>

Expand All @@ -859,7 +862,10 @@ <h1>Source code for arkouda.util</h1><div class="highlight"><pre>
<span class="sd"> False</span>

<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arry</span><span class="p">,</span> <span class="n">pdarray</span><span class="p">):</span>
<span class="kn">from</span> <span class="nn">arkouda.index</span> <span class="kn">import</span> <span class="n">Index</span>
<span class="kn">from</span> <span class="nn">arkouda.series</span> <span class="kn">import</span> <span class="n">Series</span>

<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arry</span><span class="p">,</span> <span class="p">(</span><span class="n">pdarray</span><span class="p">,</span> <span class="n">Series</span><span class="p">,</span> <span class="n">Index</span><span class="p">)):</span>
<span class="k">return</span> <span class="n">_is_dtype_in_union</span><span class="p">(</span><span class="n">dtype</span><span class="p">(</span><span class="n">arry</span><span class="o">.</span><span class="n">dtype</span><span class="p">),</span> <span class="n">numeric_scalars</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">False</span></div>
Expand All @@ -868,7 +874,7 @@ <h1>Source code for arkouda.util</h1><div class="highlight"><pre>

<div class="viewcode-block" id="is_float">
<a class="viewcode-back" href="../../autoapi/arkouda/util/index.html#arkouda.is_float">[docs]</a>
<span class="k">def</span> <span class="nf">is_float</span><span class="p">(</span><span class="n">arry</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">pdarray</span><span class="p">,</span> <span class="n">Strings</span><span class="p">,</span> <span class="n">Categorical</span><span class="p">]):</span> <span class="c1"># noqa: F821</span>
<span class="k">def</span> <span class="nf">is_float</span><span class="p">(</span><span class="n">arry</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">pdarray</span><span class="p">,</span> <span class="n">Strings</span><span class="p">,</span> <span class="n">Categorical</span><span class="p">,</span> <span class="s2">&quot;Series&quot;</span><span class="p">,</span> <span class="s2">&quot;Index&quot;</span><span class="p">]):</span> <span class="c1"># noqa: F821</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Check if the dtype of the given array is float.</span>

Expand All @@ -893,7 +899,10 @@ <h1>Source code for arkouda.util</h1><div class="highlight"><pre>
<span class="sd"> False</span>

<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arry</span><span class="p">,</span> <span class="n">pdarray</span><span class="p">):</span>
<span class="kn">from</span> <span class="nn">arkouda.index</span> <span class="kn">import</span> <span class="n">Index</span>
<span class="kn">from</span> <span class="nn">arkouda.series</span> <span class="kn">import</span> <span class="n">Series</span>

<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arry</span><span class="p">,</span> <span class="p">(</span><span class="n">pdarray</span><span class="p">,</span> <span class="n">Series</span><span class="p">,</span> <span class="n">Index</span><span class="p">)):</span>
<span class="k">return</span> <span class="n">_is_dtype_in_union</span><span class="p">(</span><span class="n">dtype</span><span class="p">(</span><span class="n">arry</span><span class="o">.</span><span class="n">dtype</span><span class="p">),</span> <span class="n">float_scalars</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">False</span></div>
Expand All @@ -902,7 +911,7 @@ <h1>Source code for arkouda.util</h1><div class="highlight"><pre>

<div class="viewcode-block" id="is_int">
<a class="viewcode-back" href="../../autoapi/arkouda/util/index.html#arkouda.is_int">[docs]</a>
<span class="k">def</span> <span class="nf">is_int</span><span class="p">(</span><span class="n">arry</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">pdarray</span><span class="p">,</span> <span class="n">Strings</span><span class="p">,</span> <span class="n">Categorical</span><span class="p">]):</span> <span class="c1"># noqa: F821</span>
<span class="k">def</span> <span class="nf">is_int</span><span class="p">(</span><span class="n">arry</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">pdarray</span><span class="p">,</span> <span class="n">Strings</span><span class="p">,</span> <span class="n">Categorical</span><span class="p">,</span> <span class="s2">&quot;Series&quot;</span><span class="p">,</span> <span class="s2">&quot;Index&quot;</span><span class="p">]):</span> <span class="c1"># noqa: F821</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Check if the dtype of the given array is int.</span>

Expand All @@ -928,7 +937,10 @@ <h1>Source code for arkouda.util</h1><div class="highlight"><pre>
<span class="sd"> True</span>

<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arry</span><span class="p">,</span> <span class="n">pdarray</span><span class="p">):</span>
<span class="kn">from</span> <span class="nn">arkouda.index</span> <span class="kn">import</span> <span class="n">Index</span>
<span class="kn">from</span> <span class="nn">arkouda.series</span> <span class="kn">import</span> <span class="n">Series</span>

<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arry</span><span class="p">,</span> <span class="p">(</span><span class="n">pdarray</span><span class="p">,</span> <span class="n">Series</span><span class="p">,</span> <span class="n">Index</span><span class="p">)):</span>
<span class="k">return</span> <span class="n">_is_dtype_in_union</span><span class="p">(</span><span class="n">dtype</span><span class="p">(</span><span class="n">arry</span><span class="o">.</span><span class="n">dtype</span><span class="p">),</span> <span class="n">int_scalars</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">False</span></div>
Expand All @@ -947,7 +959,7 @@ <h1>Source code for arkouda.util</h1><div class="highlight"><pre>
<span class="sd"> ----------</span>
<span class="sd"> values : pdarray, Strings, or Categorical</span>
<span class="sd"> The values to be mapped.</span>
<span class="sd"> mapping : dict or Series</span>
<span class="sd"> mapping : dict or arkouda.Series</span>
<span class="sd"> The mapping correspondence.</span>

<span class="sd"> Returns</span>
Expand Down Expand Up @@ -989,8 +1001,8 @@ <h1>Source code for arkouda.util</h1><div class="highlight"><pre>

<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="n">mapping</span> <span class="o">=</span> <span class="n">Series</span><span class="p">(</span>
<span class="p">[</span><span class="n">array</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">mapping</span><span class="o">.</span><span class="n">keys</span><span class="p">())),</span> <span class="n">array</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">mapping</span><span class="o">.</span><span class="n">values</span><span class="p">()))]</span> <span class="c1"># type: ignore [assignment]</span>
<span class="p">)</span>
<span class="p">[</span><span class="n">array</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">mapping</span><span class="o">.</span><span class="n">keys</span><span class="p">())),</span> <span class="n">array</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">mapping</span><span class="o">.</span><span class="n">values</span><span class="p">()))]</span>
<span class="p">)</span> <span class="c1"># type: ignore [assignment]</span>

<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="n">Series</span><span class="p">):</span>
<span class="n">xtra_keys</span> <span class="o">=</span> <span class="n">gb_keys</span><span class="p">[</span><span class="n">in1d</span><span class="p">(</span><span class="n">gb_keys</span><span class="p">,</span> <span class="n">mapping</span><span class="o">.</span><span class="n">index</span><span class="o">.</span><span class="n">values</span><span class="p">,</span> <span class="n">invert</span><span class="o">=</span><span class="kc">True</span><span class="p">)]</span>
Expand Down
8 changes: 4 additions & 4 deletions _sources/autoapi/arkouda/util/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Functions
:rtype: ak.array


.. py:function:: is_float(arry: Union[arkouda.pdarrayclass.pdarray, arkouda.strings.Strings, arkouda.categorical.Categorical])
.. py:function:: is_float(arry: Union[arkouda.pdarrayclass.pdarray, arkouda.strings.Strings, arkouda.categorical.Categorical, arkouda.series.Series, arkouda.index.Index])
Check if the dtype of the given array is float.

Expand All @@ -140,7 +140,7 @@ Functions
False


.. py:function:: is_int(arry: Union[arkouda.pdarrayclass.pdarray, arkouda.strings.Strings, arkouda.categorical.Categorical])
.. py:function:: is_int(arry: Union[arkouda.pdarrayclass.pdarray, arkouda.strings.Strings, arkouda.categorical.Categorical, arkouda.series.Series, arkouda.index.Index])
Check if the dtype of the given array is int.

Expand All @@ -160,7 +160,7 @@ Functions
* *True*


.. py:function:: is_numeric(arry: Union[arkouda.pdarrayclass.pdarray, arkouda.strings.Strings, arkouda.categorical.Categorical]) -> bool
.. py:function:: is_numeric(arry: Union[arkouda.pdarrayclass.pdarray, arkouda.strings.Strings, arkouda.categorical.Categorical, arkouda.series.Series, arkouda.index.Index]) -> bool
Check if the dtype of the given array is numeric.

Expand Down Expand Up @@ -200,7 +200,7 @@ Functions
:param values: The values to be mapped.
:type values: pdarray, Strings, or Categorical
:param mapping: The mapping correspondence.
:type mapping: dict or Series
:type mapping: dict or arkouda.Series

:returns: A new array with the values mapped by the mapping correspondence.
When the input Series has Categorical values,
Expand Down
Loading

0 comments on commit a7d2943

Please sign in to comment.