Below is a typical pandas function call. We're using Python to read an Excel spreadsheet, but maybe we don't want all the columns or have specific conversions we would like to perform.
pandas.read_excel(io, sheet_name=0, header=0, names=None, index_col=None, usecols=None, squeeze=False, dtype=None, engine=None, converters=None, true_values=None, false_values=None, skiprows=None, nrows=None, na_values=None, keep_default_na=True, verbose=False, parse_dates=False, date_parser=None, thousands=None, comment=None, skipfooter=0, convert_float=True, mangle_dupe_cols=True, **kwds)
Resources:
In [21]:
import pandas as pd
import numpy as np
URL = "https://www.faa.gov/airports/engineering/aircraft_char_database/media/FAA-Aircraft-Char-Database-v2-201810.xlsx"
df = pd.read_excel(URL, sheet_name="Aircraft Database",
usecols=['Manufacturer', 'Model', 'Physical Class (Engine)', '# Engines'])
In [22]:
df.head()
Out[22]:
In [19]:
df.tail()
Out[19]:
In [20]:
df.columns
Out[20]:
In [13]:
len(df)
Out[13]:
In [14]:
df.shape
Out[14]:
In [26]:
import IPython
# Grouping by one factor
df_man = df.groupby('Manufacturer')
# Getting all methods from the groupby object:
meth = [method_name for method_name in dir(df_man)
if callable(getattr(df_man, method_name)) & ~method_name.startswith('_')]
# Printing the result
print(IPython.utils.text.columnize(meth))
In [27]:
from keyword import kwlist
print(IPython.utils.text.columnize(kwlist))
In [31]:
list(df_man.groups.items())[:10]
Out[31]:
In [33]:
df_man.get_group("Acro Sport")
Out[33]:
In [34]:
df_man.size()
Out[34]:
In [35]:
df_man.count() # how many not-missing values per column per group
Out[35]:
In [36]:
df_man.nunique() # how many unique values per column per group
Out[36]:
In [ ]:
from IPython.display import YouTubeVideo
YouTubeVideo("MjHpMCIvwsY")