Using DataFrame operations to enrich data
Now that we've discussed how to query and merge DataFrame
objects, let's learn how to perform complex operations on them to create and modify columns and rows. For this section, we will be working in the 2-dataframe_operations.ipynb
notebook using the weather data, along with Facebook stock's volume traded and opening, high, low, and closing prices daily for 2018. Let's import what we will need and read in the data:
>>> import numpy as np >>> import pandas as pd >>> weather = pd.read_csv( ...     'data/nyc_weather_2018.csv', parse_dates=['date'] ... ) >>> fb = pd.read_csv( ...     'data/fb_2018.csv', index_col='date', parse_dates=True ... )
We will begin by reviewing operations that summarize entire rows and columns before moving on to binning, applying functions across rows and columns, and...