TwitterExtractor API Documentation¶
-
class
tidyextractors.tidytwitter.TwitterExtractor(source, auto_extract=True, *args, **kwargs)¶ The
TwitterExtractorclass is for extracting user data from Twitter. This class has methods for outputting data into theusersandtweetstidy formats, and a raw untidy format.Parameters: - source (list) – A list of user screen name strings.
- auto_extract (bool) – Defaults to True. If True, data is extracted automatically. Otherwise, extraction must be initiated through the internal interface.
- access_token (str) – One of four required keyword arguments that make up a complete set of Twitter API credentials.
- access_secret (str) – One of four required keyword arguments that make up a complete set of Twitter API credentials.
- consumer_key (str) – One of four required keyword arguments that make up a complete set of Twitter API credentials.
- consumer_secret (str) – One of four required keyword arguments that make up a complete set of Twitter API credentials.
-
raw(drop_collections=False)¶ Produces the extractor object’s data as it is stored internally.
Parameters: drop_collections (bool) – Defaults to False. Indicates whether columns with lists/dicts/sets will be dropped. Returns: pandas.DataFrame
-
tweets()¶ Returns a table of Twitter user data, with “tweets” as rows/observations.
Note
drop_collections is not available for this method, since there are no meaningful collections to keep.
Returns: pandas.DataFrame
-
users(drop_collections=True)¶ Returns a table of Twitter user data, with “users” as rows/observations.
Parameters: drop_collections (bool) – Defaults to True. Indicates whether columns with lists/dicts/sets will be dropped. Returns: pandas.DataFrame