<jupyter_start><jupyter_text>Write a Pandas program to convert all the string values to upper, lower cases in a given pandas series. Also find the length of the string values.<jupyter_code>import pandas as pd
import numpy as np

exam_data  = {'name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura', 'Kevin', 'Jonas'],
        'score': [12.5, 9, 16.5, np.nan, 9, 20, 14.5, np.nan, 8, 19],
        'attempts': [1, 3, 2, 3, 2, 3, 1, 1, 2, 1],
        'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']}
labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

df = pd.DataFrame(exam_data , index=labels)
df
s = df['name']
s
s.str.upper()
s.str.lower()<jupyter_output><empty_output><jupyter_text>Write a Pandas program to remove whitespaces, left sided whitespaces and right sided whitespaces of the string values of a given pandas series.<jupyter_code>color1 = pd.Index([' Green', 'Black ', ' Red ', 'White', ' Pink '])
color1
print("\nRemove whitespace")
color1.str.strip()
print("\nRemove left sided whitespace")
color1.str.lstrip()
print("\nRemove Right sided whitespace")
color1.str.rstrip()<jupyter_output>Remove Right sided whitespace<jupyter_text>Write a Pandas program to add leading zeros to the integer column in a pandas series and makes the length of the field to 8 digit.<jupyter_code>nums = {'amount': [10, 250, 3000, 40000, 500000]}
print("Original dataframe:")
df = pd.DataFrame(nums)
df
df['amount'] = df['amount'].apply(lambda x: '{0:0>8}'.format(x))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to add leading zeros to the character column in a pandas series and makes the length of the field to 8 digit.<jupyter_code>df = pd.DataFrame({
    'name': ['alberto','gino','ryan', 'Eesha', 'syed'],
    'date_of_birth ': ['17/05/2002','16/02/1999','25/09/1998','11/05/2002','15/09/1997'],
    'age': [18.5, 21.2, 22.5, 22, 23]
})
print("Original DataFrame:")
df
print("\nAfter capitalizing name column:")
df['name'] = list(map(lambda x: x.capitalize(), df['name']))
df<jupyter_output>After capitalizing name column:<jupyter_text>Write a Pandas program to count of occurrence of a specified substring in a DataFrame column.<jupyter_code>df = pd.DataFrame({
    'name_code': ['c001','c002','c022', 'c2002', 'c2222'],
    'date_of_birth ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'age': [18.5, 21.2, 22.5, 22, 23]
})
print("Original DataFrame:")
df
print("\nCount occurrence of 2 in date_of_birth column:")
df['count'] = list(map(lambda x: x.count("2"), df['name_code']))
df<jupyter_output>Count occurrence of 2 in date_of_birth column:<jupyter_text>Write a Pandas program to find the index of a substring of DataFrame with beginning and end position.<jupyter_code>df = pd.DataFrame({
    'name_code': ['c0001','1000c','b00c2', 'b2c02', 'c2222'],
    'date_of_birth ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'age': [18.5, 21.2, 22.5, 22, 23]
})
print("Original DataFrame:")
df
print("\nIndex of a substring in a specified column of a dataframe:")
df['Index'] = list(map(lambda x: x.find('c', 0, 5), df['name_code']))
df<jupyter_output>Index of a substring in a specified column of a dataframe:<jupyter_text>Write a Pandas program to check whether alpha numeric values present in a given column of a DataFrame.<jupyter_code>df = pd.DataFrame({
    'name_code': ['Company','Company a001','Company 123', '1234', 'Company 12'],
    'date_of_birth ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'age': [18.5, 21.2, 22.5, 22, 23]
})
print("Original DataFrame:")
df
print("\nWhether all characters in the string are alphanumeric?")
df['name_code_is_alphanumeric'] = list(map(lambda x: x.isalnum(), df['name_code']))
df<jupyter_output>Whether all characters in the string are alphanumeric?<jupyter_text>Write a Pandas program to check whether alphabetic values present in a given column of a DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Company','Company a001','Company 123', 'abcd', 'Company 12'],
    'date_of_sale ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]})

print("Original DataFrame:")
df
print("\nWhether Alphabetic values present in company_code column?")
df['company_code_is_alpha'] = list(map(lambda x: x.isalpha(), df['company_code']))
df<jupyter_output>Whether Alphabetic values present in company_code column?<jupyter_text>Write a Pandas program to find the index of a given substring of a DataFrame column.<jupyter_code>df = pd.DataFrame({
    'name_code': ['c001','c002','c022', 'c2002', 'c2222'],
    'date_of_birth ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'age': [18.5, 21.2, 22.5, 22, 23]
})
print("Original DataFrame:")
df
print("\nCount occurrence of 22 in date_of_birth column:")
df['Index'] = list(map(lambda x: x.find('22'), df['name_code']))
df<jupyter_output>Count occurrence of 22 in date_of_birth column:<jupyter_text>Write a Pandas program to check whether only numeric values present in a given column of a DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Company','Company a001', '2055', 'abcd', '123345'],
    'date_of_sale ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]})

print("Original DataFrame:")
df
print("\nNumeric values present in company_code column:")
df['company_code_is_digit'] = list(map(lambda x: x.isdigit(), df['company_code']))
df<jupyter_output>Numeric values present in company_code column:<jupyter_text>Write a Pandas program to check whether only lower case or upper case is present in a given column of a DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['ABCD','EFGF', 'hhhh', 'abcd', 'EAWQaaa'],
    'date_of_sale ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]})
df
print("\nIs lower (company_code)?")
df['company_code_ul_cases'] = list(map(lambda x: x.islower(), df['company_code']))
df
print("\nIs Upper (company_code)?")
df['company_code_ul_cases'] = list(map(lambda x: x.isupper(), df['company_code']))
df<jupyter_output>Is Upper (company_code)?<jupyter_text>Write a Pandas program to check whether only proper case or title case is present in a given column of a DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'Hhhh', 'abcd', 'EAWQaaa'],
    'date_of_sale ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]})

print("Original DataFrame:")
df
print("\nIs proper case or title case?")
df['company_code_is_title'] = list(map(lambda x: x.istitle(), df['company_code']))
df<jupyter_output>Is proper case or title case?<jupyter_text>Write a Pandas program to check whether only space is present in a given column of a DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF ', '  ', 'abcd', ' '],
    'date_of_sale ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]})

print("Original DataFrame:")
df
print("\nIs space is present?")
df['company_code_is_title'] = list(map(lambda x: x.isspace(), df['company_code']))
df<jupyter_output>Is space is present?<jupyter_text>Write a Pandas program to get the length of the string present of a given column in a DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'skfsalf', 'sdfslew', 'safsdf'],
    'date_of_sale ': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]})
print("Original DataFrame:")
df
print("\nLength of the string in a column:")
df['company_code_length'] = df['company_code'].apply(len)
df<jupyter_output>Length of the string in a column:<jupyter_text>Write a Pandas program to get the length of the integer of a given column in a DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'skfsalf', 'sdfslew', 'safsdf'],
    'date_of_sale': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]
})
print("Original DataFrame:")
df
print("\nLength of sale_amount:")
df['sale_amount_length'] = df['sale_amount'].map(str).apply(len)
df<jupyter_output>Length of sale_amount:<jupyter_text>Write a Pandas program to check if a specified column starts with a specified string in a DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'zefsalf', 'sdfslew', 'zekfsdf'],
    'date_of_sale': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]
})
print("Original DataFrame:")
df
print("\nIf a specified column starts with a specified string?")
df['company_code_starts_with'] = list(
    map(lambda x: x.startswith('ze'), df['company_code']))

df<jupyter_output>If a specified column starts with a specified string?<jupyter_text>Write a Pandas program to swap the cases of a specified character column in a given DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'zefsalf', 'sdfslew', 'zekfsdf'],
    'date_of_sale': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]
})
print("Original DataFrame:")
df
df['swapped_company_code'] = list(map(lambda x: x.swapcase(), df['company_code']))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to convert a specified character column in upper/lower cases in a given DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'zefsalf', 'sdfslew', 'zekfsdf'],
    'date_of_sale': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]
})

df1 = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'zefsalf', 'sdfslew', 'zekfsdf'],
    'date_of_sale': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]
})

df
df['upper_company_code'] = list(map(lambda x: x.upper(), df['company_code']))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to convert a specified character column in title case in a given DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'zefsalf', 'sdfslew', 'zekfsdf'],
    'date_of_sale': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]
})
df
df['company_code_title_cases'] = list(map(lambda x: x.title(), df['company_code']))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to replace arbitrary values with other values in a given DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['A','B', 'C', 'D', 'A'],
    'date_of_sale': ['12/05/2002','16/02/1999','25/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]
})
df
print("\nReplace A with c:")
df = df.replace("A", "C")
df<jupyter_output>Replace A with c:<jupyter_text>Write a Pandas program to split a string of a column of a given DataFrame into multiple columns.<jupyter_code>df = pd.DataFrame({
    'name': ['<NAME>','<NAME>','<NAME>', '<NAME>', '<NAME>'],
    'date_of_birth ': ['17/05/2002','16/02/1999','25/09/1998','11/05/2002','15/09/1997'],
    'age': [18.5, 21.2, 22.5, 22, 23]
})
df
df[["first", "middle", "last"]] = df["name"].str.split(" ", expand = True)
print("\nNew DataFrame:")
df<jupyter_output>New DataFrame:<jupyter_text>Write a Pandas program to extract email from a specified column of string type of a given DataFrame.<jupyter_code>import re as re
pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'name_email': ['<NAME> <EMAIL>','<NAME> <EMAIL>','<NAME> <EMAIL>', '<NAME>', '<NAME> <EMAIL>']
    })
print("Original DataFrame:")
df
def find_email(text):
    email = re.findall(r'[\w\.-]+@[\w\.-]+',str(text))
    return ",".join(email)

df['email']=df['name_email'].apply(lambda x: find_email(x))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to extract hash attached word from twitter text from the specified column of a given DataFrame.<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'tweets': ['#Obama says goodbye','Retweets for #cash','A political endorsement in #Indonesia', '1 dog = many #retweets', 'Just a simple #egg']
    })
print("Original DataFrame:")
df
def find_hash(text):
    hword=re.findall(r'(?<=#)\w+',text)
    return " ".join(hword)

df['hash_word']=df['tweets'].apply(lambda x: find_hash(x))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to extract word mention someone in tweets using @ from the specified column of a given DataFrame.<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'tweets': ['@Obama says goodbye','Retweets for @cash','A political endorsement in @Indonesia', '1 dog = many #retweets', 'Just a simple #egg']
    })
print("Original DataFrame:")

df
def find_at_word(text):
    word=re.findall(r'(?<=@)\w+',text)
    return " ".join(word)

df['at_word']=df['tweets'].apply(lambda x: find_at_word(x))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to extract only number from the specified column of a given DataFrame.<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'company_code': ['c0001','c0002','c0003', 'c0003', 'c0004'],
    'address': ['7277 Surrey Ave.','920 N. Bishop Ave.','9910 Golden Star St.', '25 Dunbar St.', '17 West Livingston Court']
    })
print("Original DataFrame:")
df
def find_number(text):
    num = re.findall(r'[0-9]+',text)
    return " ".join(num)

df['number']=df['address'].apply(lambda x: find_number(x))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to extract only phone number from the specified column of a given DataFrame.4<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'company_code': ['c0001','c0002','c0003', 'c0003', 'c0004'],
    'company_phone_no': ['Company1-Phone no. 4695168357','Company2-Phone no. 8088729013','Company3-Phone no. 6204658086', 'Company4-Phone no. 5159530096', 'Company5-Phone no. 9037952371']
    })
print("Original DataFrame:")
df
def find_phone_number(text):
    ph_no = re.findall(r"\b\d{10}\b",text)
    return "".join(ph_no)

df['number']=df['company_phone_no'].apply(lambda x: find_phone_number(x))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to extract year between 1800 to 2200 from the specified column of a given DataFrame.4<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'company_code': ['c0001','c0002','c0003', 'c0003', 'c0004'],
    'year': ['year 1800','year 1700','year 2300', 'year 1900', 'year 2200']
    })
print("Original DataFrame:")

df
def find_year(text):
    #line=re.findall(r"\b(18[0][0]|2[0-2][00])\b",text)
    result = re.findall(r"\b(18[0-9]{2}|19[0-8][0-9]|199[0-9]|2[01][0-9]{2}|2200)\b",text)
    return result

df['year_range']=df['year'].apply(lambda x: find_year(x))

df

df['year_range']=df['year_range'].apply(lambda x:''.join(x))
df<jupyter_output><empty_output><jupyter_text>Write a Pandas program to extract only non alphanumeric characters from the specified column of a given DataFrame.<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'company_code': ['c0001#','c00@0^2','$c0003', 'c0003', '&c0004'],
    'year': ['year 1800','year 1700','year 2300', 'year 1900', 'year 2200']
    })
print("Original DataFrame:")

df
def find_nonalpha(text):
    result = re.findall("[^A-Za-z0-9 ]",text)
    return result

df['nonalpha']=df['company_code'].apply(lambda x: find_nonalpha(x))
print("\nExtracting only non alphanumeric characters from company_code:")
df<jupyter_output>Extracting only non alphanumeric characters from company_code:<jupyter_text>Write a Pandas program to extract only punctuations from the specified column of a given DataFrame.<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'company_code': ['c0001.','c000,2','c0003', 'c0003#', 'c0004,'],
    'year': ['year 1800','year 1700','year 2300', 'year 1900', 'year 2200']
    })
print("Original DataFrame:")
df
def find_punctuations(text):
    result = re.findall(r'[!"\$%&\'()*+,\-.\/:;=#@?\[\\\]^_`{|}~]*', text)
    string="".join(result)
    return list(string)
df['nonalpha']=df['company_code'].apply(lambda x: find_punctuations(x))
print("\nExtracting punctuation:")
df<jupyter_output>Extracting punctuation:<jupyter_text>Write a Pandas program to remove repetitive characters from the specified column of a given DataFrame.<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'text_code': ['t0001.','t0002','t0003', 't0004'],
    'text_lang': ['She livedd a long life.', 'How oold is your father?', 'What is tthe problem?','TThhis desk is used by Tom.']
    })
df
def rep_char(str1):
    tchr = str1.group(0)
    if len(tchr) > 1:
        return tchr[0:1] # can change the value here on repetition

def unique_char(rep, sent_text):
    convert = re.sub(r'(\w)\1+', rep, sent_text) 
    return convert

df['normal_text']=df['text_lang'].apply(lambda x : unique_char(rep_char,x))
print("\nRemove repetitive characters:")
df<jupyter_output>Remove repetitive characters:<jupyter_text>Write a Pandas program to extract numbers greater than 940 from the specified column of a given DataFrame.<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'company_code': ['c0001','c0002','c0003', 'c0003', 'c0004'],
    'address': ['7277 Surrey Ave.1111','920 N. Bishop Ave.','9910 Golden Star St.', '1025 Dunbar St.', '1700 West Livingston Court']
    })
print("Original DataFrame:")

df
def test_num_great(text): 
    result = re.findall(r'95[5-9]|9[6-9]\d|[1-9]\d{3,}',text)
    return " ".join(result)

df['num_great']=df['address'].apply(lambda x : test_num_great(x))
print("\nNumber greater than 940:")
df<jupyter_output>Number greater than 940:<jupyter_text>Write a Pandas program to extract numbers less than 100 from the specified column of a given DataFrame.<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'company_code': ['c0001','c0002','c0003', 'c0003', 'c0004'],
    'address': ['72 Surrey Ave.11','92 N. Bishop Ave.','9910 Golden Star St.', '102 Dunbar St.', '17 West Livingston Court']
    })
print("Original DataFrame:")
df
def test_num_less(n):
    nums = []
    for i in n.split():
        result = re.findall(r'\b(0*(?:[1-9][0-9]?|100))\b',i)
        nums.append(result)
        all_num=[",".join(x) for x in nums if x != []]
    return " ".join(all_num)


df['num_less'] = df['address'].apply(lambda x : test_num_less(x))
print("\nNumber less than 100:")
df<jupyter_output>Number less than 100:<jupyter_text>Write a Pandas program to check whether two given words present in a specified column of a given DataFrame.<jupyter_code>pd.set_option('display.max_columns', 10)
df = pd.DataFrame({
    'company_code': ['c0001','c0002','c0003', 'c0003', 'c0004'],
    'address': ['9910 Surrey Ave.','92 N. Bishop Ave.','9910 Golden Star Ave.', '102 Dunbar St.', '17 West Livingston Court']
    })
print("Original DataFrame:")
df
def test_and_cond(text):
    result = re.findall(r'(?=.*Ave.)(?=.*9910).*', text) 
    return " ".join(result)
df['check_two_words']=df['address'].apply(lambda x : test_and_cond(x))
print("\nPresent two words!")
df<jupyter_output>Present two words!<jupyter_text>Write a Pandas program to extract date (format: mm-dd-yyyy) from a given column of a given DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'zefsalf', 'sdfslew', 'zekfsdf'],
    'date_of_sale': ['12/05/2002','16/02/1999','05/09/1998','12/02/2022','15/09/1997'],
    'sale_amount': [12348.5, 233331.2, 22.5, 2566552.0, 23.0]
})
print("Original DataFrame:")
df
def find_valid_dates(dt):
    #format: mm-dd-yyyy
    result = re.findall(r'\b(1[0-2]|0[1-9])/(3[01]|[12][0-9]|0[1-9])/([0-9]{4})\b',dt)
    return result

df['valid_dates']=df['date_of_sale'].apply(lambda dt : find_valid_dates(dt))
print("\nValid dates (format: mm-dd-yyyy):")
df<jupyter_output>Valid dates (format: mm-dd-yyyy):<jupyter_text>Write a Pandas program to extract only words from a given column of a given DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'zefsalf', 'sdfslew', 'zekfsdf'],
    'date_of_sale': ['12/05/2002','16/02/1999','05/09/1998','12/02/2022','15/09/1997'],
    'address': ['9910 Surrey Ave.','92 N. Bishop Ave.','9910 Golden Star Ave.', '102 Dunbar St.', '17 West Livingston Court']
})
print("Original DataFrame:")
df
def search_words(text):
    result = re.findall(r'\b[^\d\W]+\b', text)
    return " ".join(result)

df['only_words']=df['address'].apply(lambda x : search_words(x))
print("\nOnly words:")
df<jupyter_output>Only words:<jupyter_text>Write a Pandas program to extract words starting with capital words from a given column of a given DataFrame.<jupyter_code>df = pd.DataFrame({
    'company_code': ['Abcd','EFGF', 'zefsalf', 'sdfslew', 'zekfsdf'],
    'date_of_sale': ['12/05/2002','16/02/1999','05/09/1998','12/02/2022','15/09/1997'],
    'address': ['9910 Surrey Avenue','92 N. Bishop Avenue','9910 Golden Star Avenue', '102 Dunbar St.', '17 West Livingston Court']
})

print("Original DataFrame:")
df
def find_capital_word(str1):
    result = re.findall(r'\b[A-Z]\w+', str1)
    return result
df['caps_word_in']=df['address'].apply(lambda cw : find_capital_word(cw))
df
print("\nExtract words starting with capital words from the sentences':")
df<jupyter_output>Extract words starting with capital words from the sentences':
StarcoderdataJupyterStructuredCleanDedup