series

HighCharts Hide Series Name from the Legend

拜拜、爱过 提交于 2019-12-02 16:55:19
I try to solve this problem several times and give up. Now, when I have met him again, I decided to ask for some help. I have this code for my Legend: legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -10, y: 100, borderWidth: 0, labelFormatter: function() { if(this.name!='Series 1') { return this.name; } else { return 'Legend'; } } } If I change the return from 'Legend' to '' the text is not shown but still there is a 'dash' on the top of the legend. If I do not use label formater function I have 'Series 1' + 'dash' like a first row in my legend. How to hide them? Please,

Replacing -inf values to np.nan in a feature pandas.series [duplicate]

南楼画角 提交于 2019-12-02 12:31:22
问题 This question already has answers here : Pandas replacing elements not working (3 answers) Closed last year . I want to replace the -inf values in a pandas.series feature (column of my dataframe) to np.nan, but I could not make it. I have tried: df[feature] = df[feature].replace(-np.infty, np.nan) df[feature] = df[feature].replace(-np.inf, np.nan) df[feature] = df[feature].replace('-inf', np.nan) df[feature] = df[feature].replace(float('-inf'), np.nan) But it does not work. Any ideas how to

Pandas - remove numbers from start of string in series

為{幸葍}努か 提交于 2019-12-02 12:09:55
问题 I've got a series of addresses and would like a series with just the street name. The only catch is some of the addresses don't have a house number, and some do. So if I have a series that looks like: Idx 0 11000 SOUTH PARK 1 20314 BRAKER LANE 2 203 3RD ST 3 BIRMINGHAM PARK 4 E 12TH What function would I write to get Idx 0 SOUTH PARK 1 BRAKER LANE 2 3RD ST 3 BIRMINGHAM PARK 4 E 12TH where any 'words' made entirely of numeric characters at the beginning of the string have been removed? As you

JFreechart filling sectors series

落花浮王杯 提交于 2019-12-02 08:28:41
问题 I am trying to create a filled series over each region of a polar plot. But the colors are not filled out right. Here is an image of what I get: http://i1122.photobucket.com/albums/l539/jpo2/polar-1.gif Here is the code I have to loop through a given section is as follows: if (i < 8) { for(int r = 0; r< 20; r+=(NumberAxis) plot.getAxis()).getTickUnit().getSize()){ for(int theta = 0; theta <= 180; theta+=30){ XYSeries series = new XYSeries(i + "π/8 " + "< θ < 2π+" + i + "π/8"); for (int e =

Replacing -inf values to np.nan in a feature pandas.series [duplicate]

こ雲淡風輕ζ 提交于 2019-12-02 07:41:56
This question already has an answer here: Pandas replacing elements not working 3 answers I want to replace the -inf values in a pandas.series feature (column of my dataframe) to np.nan, but I could not make it. I have tried: df[feature] = df[feature].replace(-np.infty, np.nan) df[feature] = df[feature].replace(-np.inf, np.nan) df[feature] = df[feature].replace('-inf', np.nan) df[feature] = df[feature].replace(float('-inf'), np.nan) But it does not work. Any ideas how to replace these values? Edit: df[feature] = df[feature].replace(-np.inf, np.nan) works BUT: df = df.replace(-np.inf, np.nan)

How to reverse the order of first and last name in a Pandas Series

冷暖自知 提交于 2019-12-02 03:10:58
I have a pandas series: names = pd.Series([ 'Andre Agassi', 'Barry Bonds', 'Christopher Columbus', 'Daniel Defoe', 'Emilio Estevez', 'Fred Flintstone', 'Greta Garbo', 'Humbert Humbert', 'Ivan Ilych']) Which looks like this: 0 Andre Agassi 1 Barry Bonds 2 Christopher Columbus 3 Daniel Defoe 4 Emilio Estevez 5 Fred Flintstone 6 Greta Garbo 7 Humbert Humbert 8 Ivan Ilych and I want to make it like this: 0 Agassi, Andre 1 Bonds, Barry 2 Columbus, Christopher 3 Defoe, Daniel 4 Estevez, Emilio 5 Flintstone, Fred 6 Garbo, Greta 7 Humbert, Humbert 8 Ilych, Ivan Someone suggested code like this, but it

segmentation fault in pi calculation (python)

梦想的初衷 提交于 2019-12-02 00:07:07
问题 def pi(times): seq = [] counter = 0 for x in range(times): counter += 2 seq.append("((%f**2)/(%f*%f))*"%(float(counter), float(counter-1), float(counter+1))) seq.append("1.0") seq = "".join(seq) seq = eval(seq) return seq*2 Anywhere past 85000 terms I get a segmentation fault and python quits. How can I avoid this? Why is it crashing? Can't it just please use more memory or something? 回答1: You appear to have found a bug in eval where it can't handle insanely long expressions: >>> eval("1.0*"

Pandas DataFrame - assign 1,0 values based on other column

落爺英雄遲暮 提交于 2019-12-01 22:46:28
I've got a dataframe containing country names & their percentage of energy output. I need to add a new column that assigns a 1 or 0, based on whether the country's energy output is above or below the median of energy output. Some dummy code is: import pandas as pd def answer(): df = pd.DataFrame({'name':['china', 'america', 'canada'], 'output': [33.2, 15.0, 5.0]}) df['newcol'] = df.where(df['output'] > df['output'].median(), 1, 0) return df['newcol'] answer() the code returns ValueError: Wrong number of items passed 2, placement implies 1 I feel like this is an incredibly simple fix but I'm

How to do I change a Series color in Excel using C#?

本小妞迷上赌 提交于 2019-12-01 22:14:32
I have written a program in C# whereby it automatically generates a graph for me from a CSV file and puts it onto a new XLS file. However, I need to change the color of the Line (as it is a Line Chart) to red rather than the default blue. I am finding this extremely difficult to do and the stuff I've found online has not worked. Please can someone tell me how to do this? Here is an example. I noticed when I tried to pass an integer that the bytes seem to be read in reverse order. So assigning 0xFF0000 makes the color blue and 0x0000FF turns the line red. Fortunately Microsoft provided an

Set Pandas column values to an array

让人想犯罪 __ 提交于 2019-12-01 21:30:28
I have the following problem: I have a dataframe like this one: col1 col2 col3 0 2 5 4 1 4 3 5 2 6 2 7 Now I have an array for example a = [5,5,5] and i want to insert this array in col3 but only in specific rows (let's say 0 and 2) and obtain something like that: col1 col2 col3 0 2 5 [5,5,5] 1 4 3 5 2 6 2 [5,5,5] The problem is that when I try to do: zip_df.at[[0,2],'col3'] = a I receive the following error ValueError: Must have equal len keys and value when setting with an ndarray . How can I solve this problem? What you're attempting is not recommended. 1 Pandas is not designed to hold list