Looking things up quickly

The search query shapes that return a usable answer on the first page, and the three Jupyter habits that answer most pandas questions without leaving the notebook.

Updated 21 Sept 20262 code blocks verifiedsearchjupyterdocumentationworkflow

Most questions during an analysis are of four kinds: how do I do this operation in pandas, what does this kind of data lie about, what does this column mean, and what does this error mean. Each has a query shape that works.

Query shapes

QuestionQueryWhy it works
a pandas operation within groupspandas <verb> per group or pandas groupby <verb>“per group” is the phrase the answers use; “rolling per group”, “shift per group”, “rank within group”
domain traps in an unfamiliar dataset<data type> data quality issues · common pitfalls <data type> backtestreturns the ten-line list of what that data lies about; see common data-quality traps
the meaning of a column<column name> meaning <domain> · <dataset name> data dictionarymost public datasets have a data dictionary; the column name plus the word “meaning” finds it
an error messagepaste the last line of the traceback, minus any file paths and variable namesthe type and message are what other people searched for
a method’s argumentspandas <Class>.<method>goes straight to the API page; check the “New in version” notes against the installed version
statistics<test name> assumptions · <estimator> standard error formulafor anything you need to write from scratch, see OLS from first principles

Add the pandas version to a query when an answer looks version-specific: pandas <version> groupby apply include_groups.

Jupyter, without leaving the cell

Three habits answer most “how does this function work” questions faster than a browser.

HabitWhat it gives
obj.method?the docstring: signature, arguments, examples
obj.method??the source, when the function is written in Python
Shift+Tab inside the parenthesesthe signature and the start of the docstring, inline
Tab after a dotevery attribute and method, which answers “is there a method for this”
import pandas as pd
print(pd.Series.rolling.__doc__.split("\n")[1].strip())        # the first line of the docstring, from a script

Outside Jupyter, help(pd.Series.rolling) prints the same docstring.

Check the version before trusting an answer

import sys, pandas as pd
print(sys.version.split()[0], "| pandas", pd.__version__)

An answer written for the newest pandas may use arguments that do not exist on the release in front of you, and one written years ago may rely on behaviour that has since changed. The portable idioms page lists the differences that come up most.

What not to search for

The thing you are actually trying to decide. “Should I drop tickers with short histories” has no answer on the internet, because it depends on the question, the data and the time available. Search for the operation once the decision is made; make the decision yourself; write it down. See questions to resolve before modelling.