Thanks to euri10 for use_index = False ts = ['20140101', '20140102', '20140105', '20140106', '20140107'] xs = pd.Series(data=range(len(ts)), index=pd.to_datetime(ts)) fig, ax = plt.subplots() xs.plot(use_index=False) ax.set_xticklabels(pd.to_datetime(ts)) ax.set_xticks(range(len(ts))) fig.autofmt_xdate() plt.show() ...

Try this: d = dict() column = list() for _, a, b in df.itertuples(): if b != '0': d[a] = b else: d.pop(a, None) column.append(d.copy()) df['C'] = column ...

i and fact(i+1) are both ints, so you're performing integer division. Since i < fact(i+1), each such term will produce a zero. You had the right idea with defining sign as a double, but since / and * have the same precedence, you're first performing an integer division and only...

python,pandas,dataframes,series

You could do so with some nested list comprehension, followed by an application of pandas.DataFrame.from_records: import pandas as pd records = [tuple(f(A, O) for A in AP) for O in OP] pd.DataFrame.from_records(records) ...

it should be: In [32]: grouped = df.groupby("student_id") In [33]: grouped.filter(lambda x: x["student_id"].count()==1) Updates: i'm not sure about the issue u mentioned regarding the interactive console. technically speaking in this particular case (there might be other situations such as the intricate "import" functionality in which diff env may behave differently),...

python,pandas,indexing,dataframes,series

The reason that it is converting the indexes to strings is because the last index intercept [-11.4551819018] in your series data is a string. The documentation for the Pandas data frames state that when constructing a data frame from a series the data frame keeps the same indexing from the...

python,pandas,add,dataframes,series

In case there is any other poor ghost out there which needs this info... It seems like a dirty work-around, but it works: # add() works for mutual indices, so find intersection and call it # fortunately, it appends list2 to list1! intersection = series1.index.intersection(series2.index) inter1 = series1[series1.index.isin(intersection)] inter2 =...

c#,charts,series,stacked-chart

You probably have wrong X-Values for the purpose. Note that your Series can only stack where DataPoints have the same X-Value. DateTimes include times downto fractions of a second, so they will never stack unless you twist them to meet your goal.. You code is closely missing the point here:...

c#,winforms,charts,colors,series

The colors are assigned automatically according to a palette, unless a color has been set explicitly. So the next series down gets the freed up color. To avoid this, you need to explicitly set the colors of all series. See http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.series.palette(v=vs.110).aspx...

Use shift. df['dA'] = df['A'] - df['A'].shift(-1) ...

python,datetime,pandas,series,multi-index

You can add them (if you first multiply the hours by the number of nanoseconds), but you have to drop down to numpy to do the calculation*: In [11]: dr = pd.date_range('2014', periods=5) In [12]: hours = pd.Index(np.arange(5)) In [13]: pd.DatetimeIndex(dr.values + hours.values * pd.offsets.Hour(1).nanos) Out[13]: <class 'pandas.tseries.index.DatetimeIndex'> [2014-01-01 00:00:00,...

c#,colors,charts,linechart,series

As I'm not sure of what values you are binding, it would be better to capture all values above and inclusive of your maximum. I suggest changing your first IF statement to: if (c.Series[s].YValuesPerPoint >= 255) c.Series[s].Color = Color.Red; ...

Ok, got it going finally. One has to pass the JSON as an object (and not an array, and neither as string (so, no quotes like ' or " around the object!). Works like a charm here on fiddle. Here the code: $(function () { var options = { chart:...

You could loop over each string in each row to create a new series: pd.Series([j for i in s.str.split('\n') for j in i]) It might make more sense to do this on the input rather than creating a temporary series, e.g.: strings = ['This is a single line.', 'This is...

If you take two data points (a and b) you can use the equation of a line to get Y for any X point (or X for any Y point) between them: public static int GetX(int y, Point a, Point b) { var m = CalculateSlope(a, b); // Horizontal line...

excel,vba,charts,excel-formula,series

If you use .FormulaR1C1 = Replace(.FormulaR1C1 , "A", L) instead of .Formula = Replace(.Formula, "A", L) the '1004' goes away. Beats me why but it's alway worth trying when '.formula' results in an error. You'll still have to put some thought into the positioning of the charts though. Currently they...

You could construct a mask -- a boolean array which is True where the Series index equals the particular value: mask = my_series.index.isin(['intercept']) Then you could select the remaining rows in the typical fashion: my_series.loc[~mask] Note that if the value occurs in the index more than once, then all rows...

If you can't run the code, you can look at the for loops: for(int i = 0; i < n-1; i++) for(int j = i+1; j <= n; j++) The first loop runs n-1 times. The second loop runs n-i-1 times (for each i). So the total loop runs is...

If all functions are in order, you could add all of your functions to an array: var functions = [function_zero, function_one, function_two, wrap_up]; and then execute them with for example the async module as follows: async.series(functions); The benefint of adding them to an array is that you could slice the...

python,pandas,dataframes,series

If the date column has dtype datetime64[ns] and the time column has dtype timedelta64[ns] then you can add them together to form a new column of dtype datetime64[ns]. Then you could set that column as the index and select the frequ column to obtain the desired Series: import pandas as...

This will do what you want: =INDIRECT("B"&(17*(ROW(C5)-5))+5) Indirect allows us to construct a string of text to represent an address. We are taking the row it's on and taking away 5 then multiplying the result by 17 then adding 5. On row 5 this will be 5-5=0 * 17 =...

Presumably your factorial function, which you're not showing, is performing integer arithmetic. After 12! you're going to overflow a 32-bit integer. Switch to using double in the factorial function too.

This is the Taylor's series development of exp(-x). Recognizing this gives you a good opportunity to check your result against math.exp(-x). Simple syntax improvements You don't need an 'else' after the while. Just add the code to be run after the loop at the same indentation level as before the...

"This" object is serie, so only what you need is refer to the this.name. mouseOver: function () { var color; if(this.name === 'Africa') color = 'green'; else color = 'red'; this.graph.attr('stroke', color); }, Example: http://jsfiddle.net/f3rgendb/2/...

math,wolfram-mathematica,series,calculus

This should be close: inner[i_, gamma_, k_] := Sum[(-1)^(el[1])/el[1]! Product[(-1)^(el[z] - el[z - 1])/(el[z] - el[z - 1])! ,{z, 2, i}], Evaluate[Sequence @@ ({{el[1], k, gamma}}~Join~Table[ { el[ii], el[ii - 1], gamma }, {ii, 2, i}])]] With[{gamma = 3, k = 1}, Sum[ inner[i, gamma, k], {i, gamma - 1}]]...

c#,charts,distance,mschart,series

This assumes that you want to do some sort of interpolation between points if the two series do not have the same number of points. A simple linear interpolation should work for a sufficiently large number of points, and so the whole algorithm could look something like this (in pseudo-code):...

javascript,highcharts,tooltip,series

For this you are better off using the tooltip.formatter. This gives you much more control over every aspect of the layout. Sample: tooltip: { crosshairs: true, useHTML: true, backgroundColor: '#eee', borderColor: '#000000', borderRadius: 0, formatter: function () { return '<div style="color: #000; text-align: center; font-family: Palatino, serif; font-size: 14px; line-spacing:...

javascript,arrays,series,linq.js

Loop through the array and if both your conditions are met remove that element. Is this what you are trying for? var customSeriesSums = [{ "style":"smooth", "color":"blue", "data":[ [600,30000], [800,60000], [1100,100000] ], "name":"Subject Property", "removeByNames":[ ["Product1"], ["Product2"], ["Product3"] ], "$$hashKey":"object:30" }] var sqft = 800; var price = 60000; var...

colors,javafx,javafx-2,linechart,series

In a line chart since all elements of a single series have one color. The series are assigned with styleclass series0, series1, series2 etc. Each of these series are assigned with corresponding colors styleclass i.e. default-color0, default-color1, default-color2 etc. You can directly use the styleclass for your text/labels....

video,data,highcharts,sync,series

You can sync the variable using the event 'seeked'. When the user click on the timeline, this event is fired when the video actually go the frame the user click. Then you should sync posicao with the variable who is holding the last known position.

This is the script i personally use to make histograms. import numpy as np import pylab as P def binner(LB, UB, step=1): N = int((UB-LB+1)/float(step) + 1) return [LB + step * (i - 1/float(2)) for i in xrange(N)] def f_hist(x, bins=None, param=20, h_type='bar', barwidth=0.8,filename=None): P.figure() if bins is None:...

You were almost there. You needed to check the api for the shared tooltip formatter. Put your check for the series you do not want inside the for each: ... tooltip: { formatter: function () { var s = '<b>' + this.x + '</b>'; $.each(this.points, function () { if (this.series.name...

json,dynamic,highcharts,series

The general idea should be that for each series you set it's id. Then you cna get that series this way: chart.get(id). So if you have series, then add point to that series, if not, then create new one, just like this: http://jsfiddle.net/9FkJc/8/ var self = this; data = [{...

Don't use apply you can achieve the same result much faster using 3 .loc calls: df.loc[(df['column_of_ints'] >= 0) & (df['column_of_ints'] < 100), 'column_of_ints_v2'] df['column_of_ints'] df.loc[(df['column_of_ints'] >= 100) & (df['column_of_ints'] < 200), 'column_of_ints_v2'] = df['column_of_ints'] + 1 df.loc[(df['column_of_ints'] < 0) & (df['column_of_ints'] >= 200), 'column_of_ints_v2'] = df['column_of_ints'] + 2 Or using...

algorithm,math,sum,series,recurrence

No one gave the mathematical approach, so I am adding the mathematical approach to this AP problem. Given series is 1k + 2k + 3k + .... + k.k(OR k^2) Therefore, it means that there are altogether k terms together in the given series. Next, as here all the consecutive...

It sounds like you need to use groupby for this together with cumsum since you want a running total: cum_defaults = df.groupby('time_to_default').default_amnt.sum().cumsum() You then need to reindex this new series to fill in any missing days: cum_defaults = cum_defaults.reindex(index=range(min(cum_defaults.index), max(cum_defaults.index) + 1), method='ffill') With some example data: df = pd.DataFrame({'time_to_default':...

node.js,asynchronous,each,series,async.js

forEach is executed in parallel, SO that forEach is finished before Client.findById. So you can use eachSeries instead of forEach....

This was a bug fixed in 0.14.0 (coming next week), see here: http://pandas-docs.github.io/pandas-docs-travis/whatsnew.html#whatsnew-0140-api (the set_index section). You can get the pre-release here: https://github.com/pydata/pandas/releases...

select,pandas,filtering,series,setvalue

Initialize a random series: s = pd.Series(np.random.rand(4), index=idx, name='test') Create a mask on the index using list comprehension. Note that 'True' can be anywhere within the index value. Then use .loc to set the value as you have already done. idx = ['True' in i for i in s.index] s.loc[idx]...

python,string,list,pandas,series

You are basically just trying to flatten a nested list here. You should just be able to iterate over the elements of the series: slist =[] for x in series: slist.extend(x) or a slicker (but harder to understand) list comprehension: slist = [st for row in s for st in...

This is bug in 4.1.3/2.1.3 version of Highcharts/Highstock. Bug reported is here. Already fixed, that means try https://github.highcharts.com/highstock.js and https://github.highcharts.com/highcharts-more.js files from master branch. Working demo http://jsfiddle.net/ncdysafk/1/

excel,excel-vba,multiple-columns,series

You can try below code to split the data in a column to multiple columns, splitting data is based on blank cells on that column. (for multiple column you can call this module again) Below code reads the cells from Sheet1 : Column('A') : Reads 500 rows Public Sub break_data()...

python,series,factorial,exponential

Move your sumt variables into your while loop, and then break out of the loop when sumt5 <= 0.00: import decimal def fact(n): if n == 0: return 1 else: return n*(fact(n-1)) x = 1 # Hardcoded for this example, instead of prompting. A = 0 summation = 1.0 while...

The best way to force the fit function on a certain period is to resort to a custom equation model, via fittype. Another option (that will throw a warning) is to fix the lower and upper bounds of the parameter w to the same value, and select as solution method...

vb.net,charts,colors,get,series

If you are not explicitly setting a series color and want to retrieve the default assigned color, then you must call Chart.ApplyPaletteColors(). Modify your code to call this method after adding the Series to the chart's Series collection Me.ChtCurves.Series.Add(Cur.ToString) Me.ChtCurves.Series(Cur.ToString).ChartType = DataVisualization.Charting.SeriesChartType.Spline Me.ChtCurves.ChartAreas(0).AxisX.LabelStyle.Format = "#.###" Me.ChtCurves.ApplyPaletteColors() ' this will allow...

r,ggplot2,width,bar-chart,series

At the expense of doing your own calculation for the x coordinates of the bars as shown below, you can get a chart which may be close to what you're looking for. x <- c("1","2","3","1","2","3","4") s <- c("No","No","No","Yes","Yes","Yes","Yes") y <- c(1,2,3,2,3,4,5) df <- data.frame(cbind(x,s,y) ) df$x_pos[order(df$x, df$s)] <- 1:nrow(df) x_stats...

The main issue with your code is that you are using a Select Case when you seem to just need a simple If. The corrected code for that is Sub exmpl() Dim MySeries As Series ActiveSheet.ChartObjects("Chart 3").Activate For Each MySeries In ActiveChart.SeriesCollection If MySeries.Name = "NotThisSeries" Then ActiveChart.SeriesCollection(MySeries.Name).IsFiltered = True...

Here is a little workaround to do it with alpha-sections: private void SetChartTransparency(Chart chart, string Seriesname) { bool setTransparent = true; int numberOfPoints = 3; chart.ApplyPaletteColors(); foreach (DataPoint point in chart.Series[Seriesname].Points) { if (setTransparent) point.Color = Color.FromArgb(0, point.Color); else point.Color = Color.FromArgb(255, point.Color); numberOfPoints = numberOfPoints - 1; if (numberOfPoints...