Skip to content

Instantly share code, notes, and snippets.

@mutairibassam
Last active December 20, 2020 18:14
Show Gist options
  • Save mutairibassam/da748c0de739255c32e80a82e05010c1 to your computer and use it in GitHub Desktop.
Save mutairibassam/da748c0de739255c32e80a82e05010c1 to your computer and use it in GitHub Desktop.
jupyter-cell-tips
# Tip 1
# to print all the interactive output, not only the last result.
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
################################################################################
# Tips 2
# get_option() / set_option() - get/set the value of a single option.
pd.get_option("display.max_rows") # return max_rows value
pd.set_option("display.max_rows", 101) # set 101 as a new value
pd.options.display.max_rows = 4000 # another way of setting a new value
# reset_option() - reset one or more options to their default value.
pd.reset_option("display.max_rows")
################################################################################
# Tips 3
# save an output in a new txt file.
with open("file-name.txt", "w") as file:
file.write('Hello, world!')
################################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment