timeserieschart

Aggregate time series in python

ⅰ亾dé卋堺 提交于 2019-12-05 12:58:00
How do we aggregate the time series by hour or minutely granularity? If I have a time series like the following then I want the values to be aggregated by hour. Does pandas support it or is there a nifty way to do it in python? timestamp, value 2012-04-30T22:25:31+00:00, 1 2012-04-30T22:25:43+00:00, 1 2012-04-30T22:29:04+00:00, 2 2012-04-30T22:35:09+00:00, 4 2012-04-30T22:39:28+00:00, 1 2012-04-30T22:47:54+00:00, 8 2012-04-30T22:50:49+00:00, 9 2012-04-30T22:51:57+00:00, 1 2012-04-30T22:54:50+00:00, 1 2012-04-30T22:57:22+00:00, 0 2012-04-30T22:58:38+00:00, 7 2012-04-30T23:05:21+00:00, 1 2012-04

determine the coordinates where two pandas time series cross, and how many times the time series cross

非 Y 不嫁゛ 提交于 2019-12-05 12:52:40
If I were to graph two time series, let's say they both have an upward positive trend from left to right, is there anyway to use pandas to find where the two lines intersect and how often? For example: How often do the two time series intersect: 1 What are the coordinates of the intersecting points: approx x-axis: 1955 y-axis: 7 Here is a quick try using pandas. import pandas as pd import numpy as np df = pd.DataFrame({"A":[1,2,3,4,5], "B":[0.5,3,1,1,6]}) print df Which gives A B 0 1 0.5 1 2 3.0 2 3 1.0 3 4 1.0 4 5 6.0 Then use the difference df['difference'] = df.A - df.B df['cross'] = np

Alternatives for using forEeach() loop while converting data for D3.js

久未见 提交于 2019-12-04 14:58:59
I am still struggling with this error as indicated in this earlier post on StackOverflow.com . I have isolated the cause of the problem, which is in my D3.js code it is unable to iterate through an 'object'. My raw data source is a RESTful web api. Using jQuery and a JavaScript function I am able to load the values into a variable called 'dataset'. When I output the contents of 'dataset' as an alert, or write it to an html element using jQuery all the data is there. Way too many D3.js examples use hard coded files of data. So it is important to note when I use a hard coded version of the same

Where is DateTickUnit documentation?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 08:18:51
问题 I need to change the default DateTickUnit settings for different zoom levels for a TimeseriesChart, but can´t find the place i need to read in the documentation? I would greatly appreciate a pointer. 回答1: Here is the Java API for TimeSeriesChartDemo1: http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/demo/TimeSeriesChartDemo1.html The zoom levels documentation will be found in one of the inherited methods. I would recommend finding the exact component that requires the zoom to be

Where is DateTickUnit documentation?

孤人 提交于 2019-12-02 05:50:32
I need to change the default DateTickUnit settings for different zoom levels for a TimeseriesChart, but can´t find the place i need to read in the documentation? I would greatly appreciate a pointer. Here is the Java API for TimeSeriesChartDemo1: http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/demo/TimeSeriesChartDemo1.html The zoom levels documentation will be found in one of the inherited methods. I would recommend finding the exact component that requires the zoom to be changed on. Then checking the API for that java.awt component DateAxis has two static factories for creating

How to display only “last 24 hours” from a “last 72 hours” JFreeChart TimeSeries

て烟熏妆下的殇ゞ 提交于 2019-12-02 01:38:35
I wrote these 2 lines of code to create a chart using an XYDataset : final XYDataset dataset = new TimeSeriesCollection(myInfo.getSeries()); JFreeChart timechart = ChartFactory.createTimeSeriesChart(myInfo.getName() + " CPU (last 72h)", "", "CPU %", dataset, false, false, false); These lines created this nice "last 72h" chart: This is how I added the information to build this chart (this piece of code can run multiple times): SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd H:mm:ss"); Date date = simpleDateFormat.parse(dateAsStringToParse); Second second = new Second(date);

ggplot time series plotting: group by dates

久未见 提交于 2019-12-02 00:50:43
问题 I would like to plot several time series on the same panel graph, instead of in separate panels. I took the below R code from another stackoverflow post. Please note how the 3 time series are in 3 different panels. How would I be able to layer the 3 time series on 1 panal, and each line can differ in color. Time = Sys.time()+(seq(1,100)*60+c(rep(1,100)*3600*24, rep(2, 100)*3600*24, rep(3, 100)*3600*24)) Value = rnorm(length(Time)) Group = c(0, cumsum(diff(Time) > 1)) library(ggplot2) g <-

ggplot time series plotting: group by dates

假装没事ソ 提交于 2019-12-01 22:31:27
I would like to plot several time series on the same panel graph, instead of in separate panels. I took the below R code from another stackoverflow post . Please note how the 3 time series are in 3 different panels. How would I be able to layer the 3 time series on 1 panal, and each line can differ in color. Time = Sys.time()+(seq(1,100)*60+c(rep(1,100)*3600*24, rep(2, 100)*3600*24, rep(3, 100)*3600*24)) Value = rnorm(length(Time)) Group = c(0, cumsum(diff(Time) > 1)) library(ggplot2) g <- ggplot(data.frame(Time, Value, Group)) + geom_line (aes(x=Time, y=Value, color=Group)) + facet_grid(~

create specific date range in ggplot2 ( scale_x_date)

你说的曾经没有我的故事 提交于 2019-11-30 22:41:25
Hi i have yearly data from 2010 to 2050. i am trying make line plot so that my x-axis start from 2010 and end in 2050 showing 5 years interval i e i want x-axis break as ( 2010, 2015, 2020,....,2045,2050). Unfortunately it starts from 2013 and end at 2048. why ? how to fix this ? my data, code and result image are below. plot1<- ggplot(test, aes(yr, y=value)) + geom_line()+ scale_x_date(breaks = date_breaks("5 year"),labels=date_format("%Y")) + scale_y_continuous(breaks=seq(-4,6, by=1)) plot1 DATA dput(test) structure(list(value = c(2.47099989218436, 3.09640452148661, 1.32121989082519, 0

In Bokeh, how do I add tooltips to a Timeseries chart (hover tool)?

半世苍凉 提交于 2019-11-28 20:13:40
Is it possible to add Tooltips to a Timeseries chart? In the simplified code example below, I want to see a single column name ('a','b' or 'c') when the mouse hovers over the relevant line. Instead, a "???" is displayed and ALL three lines get a tool tip (rather than just the one im hovering over) Per the documentation ( http://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#hovertool ), field names starting with “@” are interpreted as columns on the data source. How can I display the 'columns' from a pandas dataframe in the tooltip? Or, if the high level TimeSeries interface doesnt