【问题标题】:GDELT: count occurence of specific themesGDELT:计算特定主题的出现次数
【发布时间】:2020-11-10 09:25:50
【问题描述】:

我试图计算术语“BITCOIN”在 GDELT 数据库的主题列中出现的频率,然后按日期对计数进行分组。这是我目前所拥有的:

SELECT DATE, SPLIT(RTRIM(Themes,';'),';') themes 

FROM `gdelt-bq.gdeltv2.gkg_partitioned` WHERE _PARTITIONTIME >= "2020-11-01 00:00:00" AND _PARTITIONTIME < "2020-11-07 00:00:00" 
#and (Themes like "%BITCOIN%")
#or (AllNames like "%bitcoin%" or AllNames like "%BITCOIN%")

and length(Themes) > 1
) select count(theme) cnt from nested, UNNEST(themes) as theme WHERE theme like "%BITCOIN%"

group by DATE

这是正确的方法吗?谢谢!

【问题讨论】:

    标签: google-bigquery gdelt


    【解决方案1】:

    以下是 BigQuery 标准 SQL

    #standardsql
    select date(_partitiontime) date, count(theme) occurences
    from `gdelt-bq.gdeltv2.gkg_partitioned`, unnest(split(themes,';')) as theme 
    where _partitiontime >= "2020-11-01 00:00:00" and _partitiontime < "2020-11-07 00:00:00" 
    and lower(theme) like "%bitcoin%"
    group by date
    -- order by date  
    

    有输出

    【讨论】:

      猜你喜欢
      • 2022-12-22
      • 2022-08-13
      • 1970-01-01
      • 1970-01-01
      • 2021-02-04
      • 2021-03-02
      • 2015-03-20
      • 1970-01-01
      相关资源
      最近更新 更多