VSCode Jupyter Notebook - can't change remote kernel
I have a jupyter notebook server running on a remote machine and I would like to use VScode to work on it. The remote server can be accessed over an ssh tunnel like so:
ssh -N -f -L localhost:8888:localhost:8888 user@server-ip
The VScode connects to this server when I set the Jupyter Server URI but it connected to the python 2.7 kernel. How do I make it use the python 3.5 kernel? Thanks.
See also questions close to this topic
Error occurs when attemping to import any module in the PyQt5 package
I have created a python file, test.py, that only imports sys, PyQt5 and PyQt5.QtCore and then prints sys.path and the file associated with these imports. Upon executing test.py the following error occurs.
['c:\\TestImport', 'c:\\Users\\vh942e\\.vscode\\extensions\\ms-python.python-2019.3.6558\\pythonFiles', 'C:\\ProgramData\\Anaconda3\\python37.zip', 'C:\\ProgramData\\Anaconda\\DLLs', 'C:\\ProgramData\\Anaconda3\\lib', 'C:\\ProgramData\\Anaconda3', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\win32', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\Pythonwin'] C:\ProgramData\Anaconda3\lib\site-packages\PyQt5\__init__.py Traceback (most recent call last): File "c:\Users\vh942e\.vscode\extensions\ms-python.python-2019.3.6558\pythonFiles\ptvsd_launcher.py", line 45, in <module> main(ptvsdArgs) File "c:\Users\vh942e\.vscode\extensions\ms-python.python-2019.3.6558\pythonFiles\lib\python\ptvsd\__main__.py", line 391, in main run() File "c:\Users\vh942e\.vscode\extensions\ms-python.python-2019.3.6558\pythonFiles\lib\python\ptvsd\__main__.py", line 272, in run_file runpy.run_path(target, run_name='__main__') File "C:\ProgramData\Anaconda3\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\ProgramData\Anaconda3\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\ProgramData\Anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "c:\TestImport\test.py", line 5, in <module> from PyQt5 import QtCore ImportError: DLL load failed: The specified module could not be found. Press any key to continue . . .
The test.py file is the only file in the C:\TestImport directory. I have run it as a script as well as trying to import in the python REPL with no success.
I have reinstalled PyQt5 but the error still continues.
When the program is executed, PyQt5 is found and its file is printed. However, PyQt5.QtCore is not found.
The QtCore.pyd and QtCore.pyi files are located in the PyQt5 folder in the C:\ProgramData\Anaconda3\lib\site-packages directory. So it appears that python is not looking in the PyQt5 folder to find QtCore or any other modules in that folder.
I do not understand why python is not looking in the recognized PyQt5 folder. Any suggestions would be helpful.
The test.py file contains the following code.
import sys print(sys.path) import PyQt5 print(PyQt5.file) from PyQt5 import QtCore print(QtCore.file)
visual studio code - show all the changed files and changes
I am looking for a plugin or feature of Code to see all the changed files and changes as we can see in SourceTree --> File Status feature, I am attaching a screenshot to demonstrate what I want, it is very easy to go over the changed files with this feature without going over all the project tree-view. I have searched plugins and could not see a single plugin doing this, there are very good ones but they show the changes in a file, does not list you all the changes in the project folder. The reason for this is I do not want to leave my ide for this.
I am aware of this nice feature Highlight changed files in file tree within visual studio code
- Cant write files to /var/www/html using the VS Code editor
Reading two large csv file and print the output
I have one large CSV file (60000 - row). I want to read that CSV row by row and find the quantile of each row and then again I want to compare the quantile value of each row by each row value. if it is greater than print over else under.
CSV File test1
title A B C D .....
h1 1 2 3 4 5 ....
h2 2 3 5 6 7 .....
h3 3 4 5 6 7 ..... . . .
count quantile test1['Quantile'] = test1.quantile(.75, axis = 1)
Then compare the value: test1.loc[test1['h1'] < 3.291224(quantile value), 'Expression Status'] = 'Under' test1.loc[test1['h1'] >= 3.291224, 'Expression Status'] = 'Over'
Can some please help me with it for large dataset... I have 60482(row) and 502(column)
Jupyter Notebook Output limit
I have a file that has 20,000+ lines. I want to print out all of them in a Notebook cell. After printing out the content, I can only see 10,000+ lines. I wonder if the output is being truncated by Notebook?
If so, is there a way to change it?
How to format index decimal digits when using pandas.io.formats.style.Styler?
Using python 3 on a jupyter notebook, I am trying to display a pandas dataframe as a table in which some cells are highlighted. I found this nice guide https://pandas.pydata.org/pandas-docs/stable/user_guide/style.html for formatting as I want, however it somehow messes up the decimal digits of some of the indices.
Specifically, I start from this dataframe
metricswhere the column
thresholdis the index (correctly shown with 2 decimal digits):
And I get the following
tablewhich is of type pandas.io.formats.style.Styler:
As you can see, the cells are highlighted but some indices appear with lots of digits.
The code I am using is reported below:
def highlight_likewise_gray(s): ''' highlight the maximum in grayscale model. ''' is_equivalent = (s >= F1_score_gray_best - 0.02) return ['background-color: yellow' if v else '' for v in is_equivalent] def highlight_likewise_rgb(s): ''' highlight the maximum in RGB model. ''' is_equivalent = (s >= F1_score_rgb_best - 0.02) return ['background-color: yellow' if v else '' for v in is_equivalent] table = metrics.style.apply(highlight_likewise_rgb,subset=['F1_rgb']).apply(highlight_likewise_gray,subset=['F1_gray'])
I suspect this may arise from the weird way in which pd.Index transforms the np.arange of indices when I create the dataframe.
threshold = np.arange(start=0, stop=0.6, step=0.05) pandas.Index(threshold)
Nonetheless, I managed to fix the visualization in the dataframe but not in the style.