Conventions used
There are a number of text conventions used throughout this book.
Code in text
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, and user input. Here is an example: "Use pip
to install the packages in the requirements.txt
file."
A block of code is set as follows. The start of the line will be preceded by >>>
and continuations of that line will be preceded by ...
:
>>> df = pd.read_csv( ...     'data/fb_2018.csv', index_col='date', parse_dates=True ... ) >>> df.head()
Any code without the preceding >>>
or ...
is not something we will run—it is for reference:
try: Â Â Â Â del df['ones'] except KeyError: Â Â Â Â pass # handle the error here
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
>>> df.price.plot( ...     title='Price over Time', ylim=(0, None) ... )
Results will be shown without anything preceding the lines:
>>> pd.Series(np.random.rand(2), name='random') 0 0.235793 1 0.257935 Name: random, dtype: float64
Any command-line input or output is written as follows:
# Windows: C:\path\of\your\choosing> mkdir pandas_exercises # Linux, Mac, and shorthand: $ mkdir pandas_exercises
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Using the File Browser pane, double-click on the ch_01 folder, which contains the Jupyter Notebook that we will use to validate our setup."
Tips or important notes
Appear like this.