<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Kelden,
<div class=""><br class="">
</div>
<span class="">I answered your SO question but for the record this is what happens:<br class="">
</span><span class=""><br class="">
</span>
<div class=""><b class="">date_index</b> is a <b class="">scalar</b> and you type <b class="">date_index.columns</b> which
<b class="">raises</b> the <b class="">error.</b><br class="">
<br class="">
<u class="">So you just need this:</u><br class="">
<pre class="lang-py prettyprinted prettyprint"><code class=""><span class="kwd">def</span><span class="pln"> predict_price</span><span class="pun">(</span><span class="pln">dates</span><span class="pun">,</span><span class="pln">price</span><span class="pun">):</span><span class="pln">
    date_index </span><span class="pun">=</span><span class="pln"> np</span><span class="pun">.</span><span class="pln">where</span><span class="pun">(</span><span class="pln">date_format</span><span class="pun">.</span><span class="pln">columns </span><span class="pun">==</span><span class="pln"> dates</span><span class="pun">)[</span><span class="lit">0</span><span class="pun">][</span><span class="lit">0</span><span class="pun">]</span><span class="pln">

    x </span><span class="pun">=</span><span class="pln"> np</span><span class="pun">.</span><span class="pln">zeros</span><span class="pun">(</span><span class="pln">len</span><span class="pun">(</span><span class="pln">date_format</span><span class="pun">.</span><span class="pln">columns</span><span class="pun">))</span><span class="pln">
    </span><span class="kwd">if</span><span class="pln"> date_index </span><span class="pun">>=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="pln">
        x</span><span class="pun">[</span><span class="pln">date_index</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="lit">1</span><span class="pln">

    </span><span class="kwd">return</span><span class="pln"> prediction</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">([</span><span class="pln">x</span><span class="pun">])[</span><span class="lit">0</span><span class="pun">]</span><span class="pln">

predict_price</span><span class="pun">(</span><span class="str">'Feb 20, 2018'</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">)</span></code></pre>
<div class=""><br class="">
</div>
<div class="">Bests,</div>
<div class="">Makis</div>
<br class="">
<br class="">
<blockquote type="cite" class="">On 11 Jun 2020, at 15:12, Kelden Dorji <<a href="mailto:keldendraduldorji@gmail.com" class="">keldendraduldorji@gmail.com</a>> wrote:<br class="">
<br class="">
<br class="">
<br class="">
Hi scikit-learn,<br class="">
I have a question related to regression models. Please find my question in the link below. I am still new to this and would appreciate any help. Thank you and have a nice day!<br class="">
<br class="">
<a href="https://stackoverflow.com/questions/62325079/issues-with-regression-model-giving-inverse-relationship" class="">https://stackoverflow.com/questions/62325079/issues-with-regression-model-giving-inverse-relationship</a> <br class="">
<br class="">
Kelden Dradul Dorji <br class="">
_______________________________________________<br class="">
scikit-learn mailing list<br class="">
scikit-learn@python.org<br class="">
https://mail.python.org/mailman/listinfo/scikit-learn<br class="">
</blockquote>
<br class="">
</div>
</body>
</html>