4. Create DataFrame

Table and MultiVariate Data with The DataFrame

Configuring pandas

# import numpy and pandas
import numpy as np
import pandas as pd

# used for dates
import datetime
from datetime import datetime, date

# Set some pandas options controlling output format
pd.set_option('display.notebook_repr_html', False)
pd.set_option('display.max_columns', 8)
pd.set_option('display.max_rows', 10)
pd.set_option('display.width', 80)

# bring in matplotlib for graphics
import matplotlib.pyplot as plt
%matplotlib inline

Creating a DataFrame using NumPy function results

Creating a DataFrame using a Python dictionary and pandas Series objects

Creating a DataFrame from a CSV file

Selecting columns of a DataFrame

Selecting rows of a DataFrame

Scalar lookup by label or location using .at[] and .iat[]

Slicing using the [] operator

Selecting rows using Boolean selection

Selecting across both rows and columns

Last updated

Was this helpful?