楼主: lbnjin
2653 1

请问: 如何统计数据集中某个词的总频数? 谢谢 [推广有奖]

  • 0关注
  • 0粉丝

硕士生

53%

还不是VIP/贵宾

-

威望
0
论坛币
1057 个
通用积分
1.5000
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
1173 点
帖子
85
精华
0
在线时间
226 小时
注册时间
2005-7-31
最后登录
2025-5-13

楼主
lbnjin 发表于 2015-11-1 16:10:58 |AI写论文
5论坛币

大家好,我想请问一下:


如何统计数据集中某个词的总频数?  这个词可能出现在任何一个column.


比如下面这个数据集:


Film

Director

Producer

Starring

Release

Fight Club

David Fincher

Art Linson

Brad  Pitt

1999

The Departed

Brad  Pitt

Leonardo DiCaprio

2006

World War Z

Marc Forster

Brad  Pitt

Brad  Pitt

2013

12 Years a  Slave

Steve McQueen

Brad Pitt

Chiwetel Ejiofor

2013

The Aviator

Martin Scorsese

Michael Mann

Leonardo DiCaprio

2004

Blood Diamond

Edward Zwick

Leonardo DiCaprio

2006

The Wolf of  Wall Street

Martin Scorsese

Leonardo DiCaprio

2013

Brad Pitt

Moneyball

2011

Sleepy Hollow

Tim Burton

Scott Rudin

Johnny Depp

1999

Pirates of the  Caribbean: Dead Man's Chest

Gore Verbinski

Jerry Bruckheimer

Johnny Depp

2006


如何统计 “Brad Pitt” 这个词的出现次数?

列的名字是没有规律的, 观测数是不确定的


谢谢!


p.s.  上面例子的CSV数据集在附件(修改txt为csv即可)

film_data.txt
下载链接: https://bbs.pinggu.org/a-1906591.html

615 Bytes

film_data

关键词:统计数据 数据集 wall street Caribbean Producers 如何 统计

沙发
木叶知秋 发表于 2015-11-1 16:10:59
  1. data test;
  2. length Film$100. Director$100. Producer$100. Starring$100.;
  3. infile datalines dsd missover;
  4. input Film$ Director$ Producer$ Starring$ Release;
  5. datalines;
  6. Fight Club,David Fincher,Art Linson,Brad Pitt,1999
  7. The Departed,,Brad Pitt,Leonardo DiCaprio,2006
  8. World War Z,Marc Forster,Brad Pitt,Brad Pitt,2013
  9. 12 Years a Slave,Steve McQueen,Brad Pitt,Chiwetel Ejiofor,2013
  10. The Aviator,Martin Scorsese,Michael Mann,Leonardo DiCaprio,2004
  11. Blood Diamond,Edward Zwick,,Leonardo DiCaprio,2006
  12. The Wolf of Wall Street,,Martin Scorsese,Leonardo DiCaprio,2013
  13. Brad Pitt,Moneyball,2011,,
  14. Sleepy Hollow,Tim Burton,Scott Rudin,Johnny Depp,1999
  15. Pirates of the Caribbean: Dead Man's Chest,Gore Verbinski,Jerry Bruckheimer,Johnny Depp,2006
  16. ;
  17. run;

  18. data test2;
  19.         set test;
  20.         retain cnt 0;
  21.         array char _character_;
  22.         do over char;
  23.                 if char eq "Brad Pitt" then cnt+1;
  24.         end;
  25. run;
复制代码

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 23:20