This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a pandas dataframe containing a pandas series/column of tuples B, | |
# we want to extract B into B1 and B2 and assign them into separate pandas series | |
# Method 1: (faster) | |
# use pd.Series.tolist() method to return a list of tuples | |
# use pd.DataFrame on the resulting list to turn it into a new pd.DataFrame object, while specifying the original df index | |
# add to the original df | |
import pandas as pd | |
import time |