範例 - Countpattern 轉換

來源:

下面的資料集含有應用程式「Myco ExampleApp」發佈後不久的虛構推文訊息。

DatetwitterIdisEmployeetweet
11/5/15lawrencetlu38141FALSEJust downloaded Myco ExampleApp! Transforming data in 5 mins!
11/5/15petramktng024TRUETry Myco ExampleApp, our new free data wrangling app! See www.example.com.
11/5/15joetri221TRUEProud to announce the release of Myco ExampleApp, the free version of our enterprise product. Check it out at www.example.com.
11/5/15datadaemon994FALSEGreat start with Myco ExampleApp. Super easy to use, and actually fun.
11/5/1599redballoons99FALSELiking this new ExampleApp! Good job, guys!
11/5/15bigdatadan7182FALSE@support, how can I find example datasets for use with your product?

分析報告中包含兩個部分:

  • 針對非員工,您想知道他們是否提到新產品的名稱。
  • 針對員工,您想知道他們是否在推文中加入了網站的交叉參照。

轉換:

下列指令會計算 tweet 資料欄中 ExampleApp 字串的出現次數。請注意如何使用 ignoreCase 參數分辨大寫字體差異:

countpattern col:tweet on:'ExampleApp' ignoreCase:true

針對非員工,您想要追蹤他們是否在推文中提到產品:

derive type:single value:IF(isEmployee=='FALSE' && countpattern_tweet=='1',true,false) as:'nonEmployeeExampleAppMentions'

以下指令計算非員工推文中,example.com 的出現次數:

countpattern col:tweet on:'example.com' ignoreCase:true

針對員工,您想要追蹤他們是否在推文中加入上述的交叉參照:

derive type:single value:IF(isEmployee=='TRUE' && countpattern_tweet1 == 1, true, false) as:'employeeWebsiteCrossRefs'

結果:

將顯示計數的兩個資料欄刪除後,會得出以下結果:

DatetwitterIdisEmployeetweetemployeeWebsiteCrossRefsnonEmployeeExampleAppMentions
11/5/15lawrencetlu38141FALSEJust downloaded Myco ExampleApp! Transforming data in 5 mins!falsetrue
11/5/15petramktng024TRUETry Myco ExampleApp, our new free data wrangling app! See www.example.com.truefalse
11/5/15joetri221TRUEProud to announce the release of Myco ExampleApp, the free version of our enterprise product. Check it out at www.example.com.truefalse
11/5/15datadaemon994FALSEGreat start with Myco ExampleApp. Super easy to use, and actually fun.falsetrue
11/5/1599redballoons99FALSELiking this new ExampleApp! Good job, guys!falsetrue
11/5/15bigdatadan7182FALSE@support, how can I find example datasets for use with your product?falsefalse
本頁內容對您是否有任何幫助?請提供意見:

傳送您對下列選項的寶貴意見...

這個網頁
Google Cloud Dataprep 說明文件
需要協助嗎?請前往我們的支援網頁