3.2.3. Common Functions/Methods


Some pandas methods work on a dataframe, like df.assign(feet=df['height']//12). These are methods that are altering a dataframe, and you use them like this: <dfname>.<method>(<arguments>).

Note: Delete the < and > after you type in the dataframe name, method, and arguments. Those are just indicating the text inside them is a placeholder.

Some pandas methods are a called on the pandas module itself (e.g. pd.merge). These are methods that are doing tasks outside a dataframe (like loading or merging datasets), and you use them like this: pd.<method>(<arguments>)

Remember the SHIFT+TAB trick to see function help!

Type import pandas as pd then run that to load pandas. Then type pd.merge( like you want to merge to dataframes, except you don’t remember the arguments to use. So type SHIFT+TAB to see the function’s documentation!