Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic_Machine_Learning_Predicts.ipynb #8

Closed
GirishKumarSharma opened this issue Sep 25, 2022 · 19 comments
Closed

Basic_Machine_Learning_Predicts.ipynb #8

GirishKumarSharma opened this issue Sep 25, 2022 · 19 comments

Comments

@GirishKumarSharma
Copy link

There are errors input onwards :

X = df.drop(['Date','Close'], axis=1, inplace=True)
y = df[['Adj Close']]

Kindly tell us what packages do we need to test and run the files like pip install yfinance, pip install seaborn etc.

The version of the notebook server is: 6.4.8
Python 3.10.7 (main, Sep 8 2022, 14:34:29) [GCC 12.2.0]
Ubuntu : 22.10 (Development Branch)

@LastAncientOne
Copy link
Owner

numpy: 1.19.5
pandas: 1.1.5
matplotlib: 3.3.4
sklearn: 0.24.2
yfinance: 0.1.63

@GirishKumarSharma
Copy link
Author

GirishKumarSharma commented Sep 27, 2022

This input generates below error :
df = df.as_matrix()
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 df = df.as_matrix()

File ~/.local/lib/python3.10/site-packages/pandas/core/generic.py:5575, in NDFrame.getattr(self, name)
5568 if (
5569 name not in self._internal_names_set
5570 and name not in self._metadata
5571 and name not in self._accessors
5572 and self._info_axis._can_hold_identifiers_and_holds_name(name)
5573 ):
5574 return self[name]
-> 5575 return object.getattribute(self, name)

AttributeError: 'DataFrame' object has no attribute 'as_matrix'
`

@LastAncientOne
Copy link
Owner

What pandas version are you using?

df.as_matrix() was deprecated after version 0.23.0. Use df.values instead.

@GirishKumarSharma
Copy link
Author

GirishKumarSharma commented Sep 27, 2022

girish@mypc:~$ gedit pd.py
girish@mypc:~$ python3 pd.py
1.4.2
girish@mypc:~$ cat pd.py
import pandas as pd
print(pd.__version__)
girish@mypc:~$

@LastAncientOne
Copy link
Owner

Did you trying using df.values?

@GirishKumarSharma
Copy link
Author

Yes, it worked. But there are errors in next/rest inputs. As you mentioned earlier that I should have all the packages of those version, how do I keep them as a temporary basis so that rest things don't suffers and how do I install those version packages please.

@LastAncientOne
Copy link
Owner

Example: pip install pandas==1.1.1

Just to let you know some of my codes are old.

@GirishKumarSharma
Copy link
Author

And your supported python version please? Because I am not able to pip install pandas==1.1.1. Below Error :

girish@mypc:~$ pip install pandas==1.1.1
Defaulting to user installation because normal site-packages is not writeable
Collecting pandas==1.1.1
Using cached pandas-1.1.1.tar.gz (5.2 MB)
Installing build dependencies ... \

.... Very huge messages

        error: Command "x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-

protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=1 -DHAVE_CBLAS -I/usr/local/include -I/usr/include -Ibuild/src.linux-x86_64-3.1/numpy/core/src/umath -Ibuild/src.linux-x86_64-3.1/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.1/numpy/core/src/common -Inumpy/core/include -Ibuild/src.linux-x86_64-3.1/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.10 -Ibuild/src.linux-x86_64-3.1/numpy/core/src/common -Ibuild/src.linux-x86_64-3.1/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.1/numpy/core/src/common -Ibuild/src.linux-x86_64-3.1/numpy/core/src/npymath -c build/src.linux-x86_64-3.1/numpy/core/src/multiarray/scalartypes.c -o build/temp.linux-x86_64-3.10/build/src.linux-x86_64-3.1/numpy/core/src/multiarray/scalartypes.o -MMD -MF build/temp.linux-x86_64-3.10/build/src.linux-x86_64-3.1/numpy/core/src/multiarray/scalartypes.o.d" failed with exit status 1
[end of output]
` note: This error originates from a subprocess, and is likely not a problem with pip.` ` error: legacy-install-failure` ` ` ` × Encountered error while trying to install package.` ` ╰─> numpy` ` ` ` note: This is an issue with the package mentioned above, not pip.` ` hint: See above for output from the failure.` ` [end of output]` ` ` ` note: This error originates from a subprocess, and is likely not a problem with pip.` `error: subprocess-exited-with-error`
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
``
note: This error originates from a subprocess, and is likely not a problem with pip.
`girish@mypc:~$ `

As always, life is tough. You Github people never supports testers... Never explains required version, never shows code in action, Sorry.

@GirishKumarSharma
Copy link
Author

I NEVER ABLE TO RUN ANY GITHUB CODE WITHOUT ANY ERROR. EVERY TIME THERE IS ISSUE AND SEES "BYE ME A COFFEE"

@LastAncientOne
Copy link
Owner

Sorry about the issues.

That was just an example: pip install pandas==1.1.1. Like I say some of my codes are old and some of the codes I was using old version packages or new version packages. Python library packages is always updating.

@LastAncientOne
Copy link
Owner

I have upload the update version. "Basic_Machine_Learning_Predicts_Updates.ipynb" .

@GirishKumarSharma
Copy link
Author

GirishKumarSharma commented Sep 29, 2022

You Said "I have upload the update version. "Basic_Machine_Learning_Predicts_Updates.ipynb" ."
From where I can download it?

@GirishKumarSharma
Copy link
Author

Still issue not solved. Let me elaborate what I did and where I am now :
When I tried to install :
numpy: 1.19.5
pandas: 1.1.5
matplotlib: 3.3.4
sklearn: 0.24.2
yfinance: 0.1.63

I could not able. Because different sources were telling that I need to have python 3.8. So I installed python 3.8 (little bit different story, but yes, it got installed link is : https://www.linuxcapable.com/how-to-install-python-3-8-on-ubuntu-22-04-lts/) and then uninstalled numpy,pandas,sklearn,yfinance. Then I ran : (in environment)

pip install numpy==1.19.5
pip install pandas==1.1.5
pip install scikit-learn==0.24.2
pip install yfinance==0.1.63
ipython kernel install --user --name=test_app_venv

(test_app_venv) girish@mypc:~/test_app$ jupyter notebook
[I 2022-10-01 19:31:43.244 LabApp] JupyterLab extension loaded from /home/girish/.local/lib/python3.10/site-packages/jupyterlab
[I 2022-10-01 19:31:43.244 LabApp] JupyterLab application directory is /home/girish/.local/share/jupyter/lab
[I 19:31:43.247 NotebookApp] Serving notebooks from local directory: /home/girish/test_app
[I 19:31:43.247 NotebookApp] Jupyter Notebook 6.4.8 is running at:
[I 19:31:43.247 NotebookApp] http://localhost:8888/?token=acf21f9aa4b5f9c959f9f3668d07b6261a577a23da2d8a23
[I 19:31:43.247 NotebookApp] or http://127.0.0.1:8888/?token=acf21f9aa4b5f9c959f9f3668d07b6261a577a23da2d8a23
[I 19:31:43.247 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 19:31:43.261 NotebookApp]

But, it is saying Pandas is missing. It is not loading with python 3.8 and above version libraries. I don't know how these all will run in today's environment python 3.10 and ubuntu 22.10.
when I says :

@GirishKumarSharma
Copy link
Author

GirishKumarSharma commented Oct 1, 2022

Even, when I changes the kernel in Juypter it is still saying :

---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import pandas as pd
2 import numpy as np
3 import math

ModuleNotFoundError: No module named 'pandas'

When I says :

(test_app_venv) girish@mypc:~/test_app$ cat pd.py
import pandas as pd
print(pd.__version__)

(test_app_venv) girish@mypc:~/test_app$ python pd.py
1.1.5
(test_app_venv) girish@mypc:~/test_app$ python --version
Python 3.8.13
(test_app_venv) girish@mypc:~/test_app$

@LastAncientOne
Copy link
Owner

I am using python version 3.6.

@GirishKumarSharma
Copy link
Author

Are you sure, above error stack will be removed if I install 3.6?

@LastAncientOne
Copy link
Owner

LastAncientOne commented Oct 2, 2022

This is what I am using.
numpy: 1.19.5
pandas: 1.1.5
sklearn: 0.24.2
yfinance: 0.1.63
os system: nt
Python Version: 3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)]
Platform System: Windows

I have not test on new version of python. I am mostly using Python 3.5 and 3.6.

@GirishKumarSharma
Copy link
Author

I created a Virtual Machine Ubuntu 18.04 which comes python 3.6.9 with it.
But, my issues are not going to end :

girish@pc1804:~$ pip install numpy==1.19.5
Collecting numpy==1.19.5
Could not find a version that satisfies the requirement numpy==1.19.5 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0rc1, 1.13.0rc2, 1.13.0, 1.13.1, 1.13.3, 1.14.0rc1, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0rc1, 1.16.0rc2, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6)
No matching distribution found for numpy==1.19.5
girish@pc1804:~$ python3 --version
Python 3.6.9
girish@pc1804:~$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants