同事问最近是否有拼音首字母带‘G’的客户申请新建。
import pandas as pd
from pypinyin import lazy_pinyin
sheet = pd.read_excel('nicknameInfo.xlsx',sheet_name = 'reportByCustomer')
cusName = sheet['Customer Name']
filter_result = []
for customer in cusName:
fpinyin = lazy_pinyin(customer)[0][0]
if fpinyin.lower() == 'g':
filter_result.append(customer)
print(filter_result)