Considering the dataframe below:
import pandas as pd
df = pd.DataFrame({'Ticker': ['EWZ US 05/29/20 P27', 'HSI US 12/30/20 C24800', 'TLT US 06/19/20 C225'],
'Market': ['US NYSE', 'US NYSE', 'HK HKSE']})
df
I need to create a new column with all the characters that appear before the first digit in df['Ticker']. I'm try the following:
numbers = [0,1,2,3,4,5,6,7,8,9]
f = lambda x: len(df['Ticker'].split(numbers)) -1
df['Reduced_Ticker'] = df.apply(f, axis=1)
but I receive the following error: 'Series' object has no attribute 'split'. Can anyone help? Output expected:
Ticker | Market | Reduced_Ticker
EWZ US 05/29/20 P27 | US NYSE | EWZ US
HSI US 12/30/20 C24800 | US NYSE | HSI US
TLT US 06/19/20 C225 | HK HKSE | HK HKSE