To enable code autocomplete in Jupyter Notebook or JupyterLab, you just need to hit the Tab key while writing code. Jupyter will suggest a few completion options. Navigate to the one you want with the arrow keys, and hit Enter to choose the suggestion.
Yes you have auto-complete built-in Jupyter, like you have in any other Jupyter environment. Simply hit the "Tab" key while writing code. This will open a menu with suggestions. Hit "Enter" to choose the suggestion.
(In Python Shell window, you can use TAB key besides the key combination of 'CTRL' and 'space' to invoke the built-in auto-completion feature.) Alternatively, you can choose the "Show Completions" in the main Edit menu to achieve the same as well.
There is an extension called Hinterland for jupyter, which automatically displays the drop down menu when typing. There are also some other useful extensions.
In order to install extensions, you can follow the guide on this github repo. To easily activate extensions, you may want to use the extensions configurator.
The auto-completion with Jupyter Notebook is so weak, even with hinterland extension. Thanks for the idea of deep-learning-based code auto-completion. I developed a Jupyter Notebook Extension based on TabNine which provides code auto-completion based on Deep Learning. Here's the Github link of my work: jupyter-tabnine.
It's available on pypi index now. Simply issue following commands, then enjoy it:)
pip3 install jupyter-tabnine
jupyter nbextension install --py jupyter_tabnine
jupyter nbextension enable --py jupyter_tabnine
jupyter serverextension enable --py jupyter_tabnine
I would suggest hinterland extension.
In other answers I couldn't find the method for how to install it from pip, so this is how you install it.
First, install jupyter contrib nbextensions by running
pip install jupyter_contrib_nbextensions
Next install js and css file for jupyter by running
jupyter contrib nbextension install --user
and at the end run,
jupyter nbextension enable hinterland/hinterland
The output of last command will be
Enabling notebook extension hinterland/hinterland...
- Validating: OK
As mentioned by @physicsGuy above, You can use the hinterland extension. Simple steps to do it.
Installing nbextension using conda forge channel. Simply run the below command in conda terminal:
conda install -c conda-forge jupyter_nbextensions_configurator
Next Step enabling the hinterland extension. Run the below command in conda terminal:
jupyter nbextension enable hinterland/hinterland
That's it, done.
Without doing this %config IPCompleter.greedy=True
after you import a package like numpy or pandas in this way;
import numpy as np
import pandas as pd
.
Then you type in pd.
then tap the tab button it brings out all the possible methods to use very easy and straight forward.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With