問題: 將字段'Channel Name'中的值分別替換成如下結果
'FOX CHINA-DF'替換為'FOC',
'FOX CZECH-DF'替換為'FCZ',
'FOX TEXAS-DF'替換為'FTX'
'FOX JUAREZ'替換為'FJZ',
'FOX JUAREZ-DF'替換為'FJZ DF'
import pandas as pd
df = pd.DataFrame([[1,'FOX CHINA-DF'],
[2,'FOX CZECH-DF'],
[3,'FOX TEXAS-DF'],
[4,'FOX JUAREZ'],
[5,'FOX JUAREZ-DF']
],columns = ['P/N','Channel Name'])
# 使用replace方法將'Channel Name'欄位中的值進行替換
df = df.replace({'FOX CHINA-DF':'FOC', 'FOX CZECH-DF':'FCZ', 'FOX TEXAS-DF':'FTX',
'FOX JUAREZ':'FJZ', 'FOX JUAREZ-DF':'FJZ DF'})
df
替換後的df