import pandas
data = pandas.read_csv('titanic.csv', index_col='PassengerId')
data2 = data[data.Sex == 'female']['Name']
C = []
for i in data2:
if '(' in i:
if ')' in i.split('(')[1].split(' ')[0]:
C.append(i.split('(')[1].split(' ')[0].split(')')[0])
else:
C.append(i.split('(')[1].split(' ')[0])
else:
C.append(i.split('. ')[1].split(' ')[0])
print pandas.DataFrame.from_dict(C)[0].value_counts()