[英]What is the most pythonic way to combine multiple string columns to create a new Pandas series?
為了避免 NAs,這里有一種使用agg
的方法:
df_with_line_sentences.agg(lambda x: ' '.join(i for i in x if not pd.isna(i)), axis=1)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.