亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用函數過濾 Pandas DataFrame

使用函數過濾 Pandas DataFrame

侃侃無極 2023-05-09 14:57:57
這個問題與我昨天發布的問題有關,可以在這里找到。因此,我繼續將 Jan 提供的解決方案實施到整個數據集。解決方法如下:import redef is_probably_english(row, threshold=0.90):    regular_expression = re.compile(r'[-a-zA-Z0-9_ ]')    ascii = [character for character in row['App'] if regular_expression.search(character)]    quotient = len(ascii) / len(row['App'])    passed = True if quotient >= threshold else False    return passedgoogle_play_store_is_probably_english = google_play_store_no_duplicates.apply(is_probably_english, axis=1)google_play_store_english = google_play_store_no_duplicates[google_play_store_is_probably_english]因此,據我了解,我們正在使用 is_probably_english 函數過濾 google_play_store_no_duplicates DataFrame 并將結果(布爾值)存儲到另一個 DataFrame (google_play_store_is_probably_english) 中。然后使用 google_play_store_is_probably_english 過濾掉 google_play_store_no_duplicates DataFrame 中的非英語應用程序,最終結果存儲在新的 DataFrame 中。這是否有意義,是否看起來是解決問題的好方法?有一個更好的方法嗎?
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 93 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號