I have column CityCountry in my dataframe. I want to split City:Country by delimeter ":" and create 2 columns such City and Country. I wrote code but got 'list index out of range' error. Does anybody have any idea about this?
import pandas as pd
result_df['CityCountry'] = ["İstanbul:Turkey", "Valencia:United States", "not set"]
result_df["City"] = result_df["City"].apply(lambda row: row.split(":")[0])
result_df["Country"] = result_df["City"].apply(lambda row: row.split(':')[1])
result_df