help(abs)

"""
Explanation: Introduction
This is a basic tutorial on getting direct info and help of python modules from within a Jupyter notebook. Some of this tutorial is specific to Linux (particularly the commands that start with "!").
Getting Basic Help from the Python interpreter
Let's get help on Python's built-in abs function:
End of explanation
"""


import numpy as np
help(np)

"""
Explanation: We have to import the numpy module in order to get help on any of its functions which we attempt below. But if we ask for help on all of np (numpy), it blocks it due to simply too much output for the browser to handle. Besides, we won't be able to read it all in one sitting. So see the Help menu in the notebook web page for numpy which today points to: https://docs.scipy.org/doc/numpy/reference/
End of explanation
"""


!echo this is output from the echo command from the Linux shell

!python --version

!python -c 'print("foo"); print("bar")'

"""
Explanation: but we can execute commands from the Linux shell like this:
End of explanation
"""


!python -c 'print("foo"); print("bar")' | wc -l

"""
Explanation: We can count the number of lines of output of whatever command we want. Here it is the simple one-liner of python that is generating two lines of output:
End of explanation
"""


!python -c 'import numpy as np; help(np)' | wc -l

"""
Explanation: And here is why we got the IOPub data rate exceeded error above! There is a lot of output from the help on the np module, and we do not want to see it all, anyhow.
End of explanation
"""


!python -c 'import numpy as np; help(np)' | head -20

"""
Explanation: But we can explore some of it by using basic Linux shell commands:
End of explanation
"""


!python -c 'import numpy as np; help(np)' 2>/dev/null | head -20

"""
Explanation: We can ignore the big traceback from python. All it is telling us that it failed to write to the stdout, because the head command is closing its side of the pipe after 20 lines of output received.
That is nothing to worry about, but if we cared, we could just use 2&gt;/dev/null to send all of the error (on stderr!) to the bit bucket to hide it (which normally, we should not do because it would hide errors we do need to pay attention to, but not in this peculiar case):
End of explanation
"""


import numpy as np
help(np.linspace)

"""
Explanation: Getting help on numpy functions
If we know what function within the particular module from online resources such as https://docs.scipy.org/doc/numpy/reference/) we are interested in, we can directly get help on it within the Jupyter notebook. But we do need to import the module before asking for it, as otherwise we will see an error:
End of explanation
"""


import numpy as np
import matplotlib as mpl

from scipy import linalg, optimize

# I don't know what difference there is between np.info and just Python's built-in help:
#   np.info(optimize.fmin)

help(optimize.fmin)

"""
Explanation: Getting help on scipy functions
Likewise, we can get help on scipi module functions:
End of explanation
"""


help(np.info)

"""
Explanation: It seems that the np.info function is close to the same as the builtin help function:
End of explanation
"""


help(np.lookfor)

np.lookfor('root')

"""
Explanation: Finding numpy functions with keywords in doc strings
End of explanation
"""


