Created
April 15, 2014 00:53
-
-
Save spilth/10693366 to your computer and use it in GitHub Desktop.
Playing with InfluxDB and my Twitter data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'CSV' | |
require 'influxdb' | |
influxdb = InfluxDB::Client.new "twitter" | |
influxdb.delete_database("twitter") | |
influxdb.create_database("twitter") | |
CSV.foreach("data/tweets.csv", {headers: true}) do |row| | |
data = { | |
time: Date.strptime(row[3]).to_time.to_i, | |
value: 1 | |
} | |
influxdb.write_point("tweet", data) | |
end | |
# select sum(value) from tweet group by time(1d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment