Subscribe Bookmark RSS Feed

How can I import twitter # data into JMP for analyzing?

tajrida

Community Trekker

Joined:

Apr 8, 2015

How can I import twitter # data into JMP for analyzing?

5 REPLIES
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

There was a thread and a blog post about this earlier.

7 things to know about Twitter

JMP/SAS Programmers: Can JMP Access Twitter's API?

-Jeff

-Jeff
M_Anderson

Staff

Joined:

Nov 21, 2014

If you mean tweets from a twitter feed or regarding a specific hashtag, then the easiest way to do this is to get the data from twitter as a CSV or Excel file.  The format that is output from Twitter via their API will import to a JMP table where there is one line per tweet with the additional information you have access to in subsequent columns.

M

tajrida

Community Trekker

Joined:

Apr 8, 2015

Thanks Jeff and Michael!!

Michael,

What is the easiest way to get specific hashtag data from twitter i.e via their API. I am very newbie to extracting data from twitter, Haven't done this before. Is there a PDF instruction, blog, or thread explaining more details?

Thanks

M

M_Anderson

Staff

Joined:

Nov 21, 2014

jeff.perkinson 's post has a link in it that goes to Craige@JMP 's uncharted blog.  It provides the steps necessary to access the API.  There are also a lot of datasets out there that have already been pulled, so a web search on the hashtag you're interested in might save you some time.

Best,

M

Craige_Hales

Staff

Joined:

Mar 21, 2013

I did a post on this a while back (Jeff mentioned above). Here's an alternate approach you might want to consider for two reasons:

1: what I did earlier represents only one of several ways you might want to capture twitter data

2: that's a mountain of JSL to do things that are easier with different tools

As I recall, twitter offers both (1) a live stream of a fraction of their content (the post I did earlier used that) and (2) one or more mechanisms to retrieve historical information (which may be more useful, and I did not investigate).  There is some important information in that post regardless of which approach you need.

I'd suggest using JMP's runProgram() function to execute a Python script that makes the twitter connection.  There were a number of Python toolkits for twitter access.  I have not looked at them in over a year, but here are two ideas:

(1) streaming.  This is pretty simple; get the Python script running (without JMP) so it just spills the data onto the screen as long as it runs.  The data may speed up, slow down, pause for a while, but the Python script just keeps dumping tweets to the screen.  Then, use RunProgram to launch the Python script and capture its output.  RunProgram can capture the data from the Python script incrementally and store it into a data table.

(2) retrieve history.  This might be simple if there is only one kind of request (embed the request in the Python code), or it might be a little more complicated if JMP needs to supply the request.  Still, get a Python script running that shows the results on the screen, then use runProgram.  If the request needs to be specified from JMP, you can either do that with command line arguments to the Python script, or you can use the runProgram <<write method to send "keystrokes" to the Python script to tell it what to do.  (use the command line options if possible, it will be simpler.)

(And the CSV approach might be even simpler.  Not sure if there is a non-API way to do that.  I *think* all the interesting ways to get data from twitter require an API that needs some form of login.  The Python toolkits do that login for you.)

If you get something running, let us know what worked.  A lot of people are interested in this.  (Most of the Python twitter toolkits will include a demo that will be pretty easy to tailor into what you want.  Google python twitter. )

Craige