series

How to make series labels to show without overlapping each other? ASP.NET 4.0

那年仲夏 提交于 2019-12-11 07:57:48
问题 I am developing a chart (using ASP.NET CHART CONTROL) with about 2 or 3 series on it. Please look how it looks like now. As you can see, the labels are overlapping each other and it does not look very good. Is there any way I can solve this problem and improve the overall look of the chart? Thanks. My code: series.ChartType = SeriesChartType.Line series.YValueType = ChartValueType.Double series.XValueType = ChartValueType.String series.BorderWidth = 1 series.ShadowOffset = 1 series

Pandas - DataFrame aggregate behaving oddly

北城余情 提交于 2019-12-11 05:57:36
问题 Related to Dataframe aggregate method passing list problem and Pandas fails to aggregate with a list of aggregation functions Consider this dataframe import pandas as pd import numpy as np df = pd.DataFrame(index=range(10)) df['a'] = [ 3 * x for x in range(10) ] df['b'] = [ 1 -2 * x for x in range(10) ] According to the documentation for aggregate you should be able to specify which columns to aggregate using a dict like this: df.agg({'a' : 'mean'}) Which returns a 13.5 But if you try to

Plotting a multiple column in Pandas (converting strings to floats)

烂漫一生 提交于 2019-12-11 05:34:57
问题 I'd like to plot "MJD" vs "MULTIPLE_MJD" for the data given here:: https://www.dropbox.com/s/cicgc1eiwrz93tg/DR14Q_pruned_several3cols.csv?dl=0 import numpy as np import pandas as pd import matplotlib.pyplot as plt import ast filename = 'DR14Q_pruned_several3cols.csv' datafile= path+filename df = pd.read_csv(datafile) df.plot.scatter(x='MJD', y='N_SPEC') plt.show() ser = df['MJD_DUPLICATE'].apply(ast.literal_eval).str[1] df['MJD_DUPLICATE'] = pd.to_numeric(ser, errors='coerce') df['MJD

Passing operators as functions to use with Pandas data frames

≯℡__Kan透↙ 提交于 2019-12-11 04:26:07
问题 I am selecting data from series on basis of threshold . >>> s = pd.Series(np.random.randn(5)) >>> s 0 -0.308855 1 -0.031073 2 0.872700 3 -0.547615 4 0.633501 dtype: float64 >>> cfg = {'threshold' : 0 , 'op' : 'less' } >>> ops = {'less' : '<', 'more': '>' , 'equal': '==' , 'not equal' : '!='} >>> ops[cfg['op']] '<' >>> s[s < cfg['threshold']] 0 -0.308855 1 -0.031073 3 -0.547615 dtype: float64 I want to use ops[cfg['op']] in last line of code , instead of '<'. I am willing to change key ,

Fourier series - Plot in Matlab

喜你入骨 提交于 2019-12-11 02:32:01
问题 Here is my m-file for Fourier series plot: clear clc syms n a0=input('Enter coefficient a0: '); an=input('Enter coefficient an: '); bn=input('Enter coefficient bn: '); a=input('Enter lower boundary: '); b=input('Enter upper boundary: '); t=linspace(a,b,10000); suma=0; for n=1:10 %% n could be any number, bigger n - better approximation suma=suma+(subs(an,'n',n).*cos(2.*n.*pi.*t./(b-a))+subs(bn,'n',n).*sin(2.*n.*pi.*t./(b-a))); end series=a0+suma; plot(t,series) grid Problem is, it is so slow!

How to find F(x,0) when F(x,i) = F(x-1,i) xor F(x-1, i+1) xor … F(x-1,n) in less than linear time

馋奶兔 提交于 2019-12-11 02:07:59
问题 Given a base array, I need to compute the value of a function given below: A[] = { a0, a1, a2, a3, .. an } F(0,i) = ai [Base case] F(1,i) = F(0,i) xor F(0,i+1) xor F(0,i+2) ... xor F(0,n) F(2,i) = F(1,i) xor F(1,i+1) xor F(1,i+2) ... xor F(1,n) . . F(x,i) = F(x-1,i) xor F(x-1,i+1) xor F(x-1,i+2) ... xor F(x-1,n) 0 < x < 10^18 0 < n < 10^5 I need to find F(x,0) . I am trying to solve this equation for the past 3 days. I have failed to optimise it and come up with a feasible solution. Any help

finding values in pandas series - Python3

社会主义新天地 提交于 2019-12-11 01:58:51
问题 i have this excruciatingly annoying problem (i'm quite new to python) df=pd.DataFrame[{'col1':['1','2','3','4']}] col1=df['col1'] Why does col1[1] in col1 return False ? 回答1: For check values use boolean indexing: #get value where index is 1 print (col1[1]) 2 #more common with loc print (col1.loc[1]) 2 print (col1 == '2') 0 False 1 True 2 False 3 False Name: col1, dtype: bool And if need get rows: print (col1[col1 == '2']) 1 2 Name: col1, dtype: object For check multiple values with or :

How to split series in two columns pandas

心已入冬 提交于 2019-12-11 01:56:30
问题 I have three lists filled with data and I would like to concatenate them to create a dataframe type of data_activationsLV : list type of data_activationsF : list type of data_activationsPC : list The structure of the data for the three lists : data_activationsLV data_activationsF data_activationsPC index a index b index c 14468 7.8 14468 7.2 14468 7.6 14469 7.8 14469 7.1 14469 7.0 14470 7.9 14470 7.9 14470 8.1 14471 8.2 14471 9.5 14471 9.9 .. I transform them into series and concate them :

How to count distance to the previous zero in pandas series?

泪湿孤枕 提交于 2019-12-10 20:15:16
问题 I have the following pandas series (represented as a list): [7,2,0,3,4,2,5,0,3,4] I would like to define a new series that returns distance to the last zero. It means that I would like to have the following output: [1,2,0,1,2,3,4,0,1,2] How to do it in pandas in the most efficient way? 回答1: The complexity is O(n) . What will slow it down is doing a for loop in python. If there are k zeros in the series, and log k is negligibile comparing to the length of series, an O(n log k) solution would

How to get dataframe index from series?

こ雲淡風輕ζ 提交于 2019-12-10 18:21:46
问题 Say I extract a series from a dataframe (like what would happen with an apply function). I'm trying to find the original dataframe index from that series. df=pd.DataFrame({'a':[1,2,3],'b':[4,5,6],'c':[7,8,9]}) x=df.ix[0] x Out[109]: a 1 b 4 c 7 Name: 0, dtype: int64 Notice the "Name: 0" piece at the bottom of the output. How can I get the value '0' from series object x? 回答1: you access it with the name attribute x.name 0 take these examples for i, row in df.iterrows(): print row.name, i 0 0 1