Last answered:

19 Mar 2024

Posted on:

01 Mar 2024

0

Python Warning while executing code

Hi Hristina,

I got a Python Warning while executing the attached code statement. What does it mean and what needs to be amended in the code so that this warning does not appear? Please see attachment (comments are for my understanding).

6 answers ( 0 marked as helpful)
Instructor
Posted on:

01 Mar 2024

0

Hey Dhaivat,


Thank you for reaching out!


Could you please let me know which version of scikit-learn you are using? You can retrieve it by typing

conda list

in your Anaconda Prompt.

 

Kind regards,

365 Hristina

 

Posted on:

01 Mar 2024

0

version. 1.2.2

Instructor
Posted on:

01 Mar 2024

0

Hey again Dhaivat,


If you open the "validation.py" file referenced in the error message (C:\Users\dhaiv\...) using any text editor or IDE, you'll find that the source code uses pandas' is_sparse() method which is deprecated since version 2.1.0 (likely, this is the version you're using or higher):

https://pandas.pydata.org/docs/reference/api/pandas.api.types.is_sparse.html


The solution would therefore be to update the scikit-learn package to the latest version where this pandas method is not referenced and the method isinstance() is used instead:

https://scikit-learn.org/stable/install.html


Let me know if you experience issues in the process.


Kind regards,

365 Hristina

Posted on:

05 Mar 2024

0

Hi Hristina,

All warnings disappered!! Thanks again.


Regards,
Dhaivat


PS: I got my answers to the Machine Learning in Excel course. Thanks for the nudge!!

Instructor
Posted on:

06 Mar 2024

0

Hey Dhaivat,


Great, I'm happy all issues are resolved! 


Kind regards,

365 Hristina

Posted on:

19 Mar 2024

0

Thank you for sharing the informative post. 

Python Classes in Nagpur 


Submit an answer