series

How to apply patches on the top of a git tree preventing duplication?

不羁岁月 提交于 2019-12-08 02:08:08
问题 I'm seeking advice for a problem that I thought to be simple, and it might be simple indeed by creating a small script, but I think there should already be a way to do that with git/quilt/stgit. I'm not exactly good at git and this is causing some issues to me. My problem: I've got a git tree (linux kernel) and a number of patches. What happens, such patches were intended for and older version of the kernel, and many of them have already been applied to my tree. The patches start with an

Append list to pandas DataFrame as new row with index

為{幸葍}努か 提交于 2019-12-08 01:38:40
问题 Despite of the numerous stack overflow questions on appending data to a dataframe I could not really find an answer to the following. I am looking for a straight forward solution to append a list as last row of a dataframe. Imagine I have a simple dataframe: indexlist=['one'] columnList=list('ABC') values=np.array([1,2,3]) # take care, the values array is a 3x1 size array. # row has to be 1x3 so we have to reshape it values=values.reshape(1,3) df3=pd.DataFrame(values,index=indexlist,columns

Changing Default Colors of WPFToolkit Chart Control

为君一笑 提交于 2019-12-07 22:40:57
问题 Does anyone know how to or found any good examples of explicitly setting the color of the data points series when using the WPFToolkit chart control? I would like to set this as a style in my XAML. 回答1: You can set the Palette on the Chart. This example is for a ColumnSeries, but you can adapt it for whatever type you are using. <charting:Chart ... Palette="{StaticResource MyPalette}"> The Palette definition looks like this: <datavis:ResourceDictionaryCollection x:Key="MyPalette">

Transform a Series in a dataframe (of pandas/Python) where the columns are the levels of the Series

社会主义新天地 提交于 2019-12-07 22:25:54
问题 I'm working with pandas and I used the groupby: group = df_crimes_query.groupby(["CrimeDateTime", "WeaponFactor"]).size() group.head(20) CrimeDateTime WeaponFactor 2016-01-01 FIREARM 11 HANDS 26 KNIFE 3 OTHER 11 UNDEFINED 102 2016-01-02 FIREARM 10 HANDS 21 KNIFE 8 OTHER 6 UNDEFINED 68 2016-01-03 FIREARM 12 HANDS 13 KNIFE 6 OTHER 5 UNDEFINED 73 2016-01-04 FIREARM 11 HANDS 10 KNIFE 1 OTHER 3 UNDEFINED 84 dtype: int64 The type of it is a Series: type(group) pandas.core.series.Series I would like

JavaFX LineChart: Insert new data in the middle of the chart

▼魔方 西西 提交于 2019-12-07 17:35:38
问题 I'm using a line chart with JavaFX: LineChart<Number, Number> lineChart = new LineChart<>(xAxis, yAxis); XYChart.Series series = new XYChart.Series(); lineChart.getData().add(series); I want to add data to the series successively, thereby the order in which the values arrive can not be predicted. For example, the index can be between 0 and the current size of the series. series.getData().add(new XYChart.Data(index, value)); Consider the following scenario: //initializing... series.getData()

pandas query with a column consisting of array entries

一个人想着一个人 提交于 2019-12-07 12:30:21
问题 ykp.data Out[182]: state action reward 0 [41] 5 59 1 [5] 52 48 2 [46] 35 59 3 [42] 16 12 4 [43] 37 48 5 [36] 5 59 6 [49] 52 48 7 [39] 11 23 I would like to find the row that matches [42] in the state entry so I ran ykp.data.query('state == [42]') but I get Empty DataFrame Columns: [state, action, reward] Index: [] when I should be seeing [42], 16, 12 . Can someone please tell me how I can workaround this? I need my state-values to be stored as arrays. 回答1: Best to avoid pd.Series.apply here.

gvisScatterChart define series dynamically

走远了吗. 提交于 2019-12-07 11:55:17
问题 I am dynamically creating a couple of gvisScatterChart s. I want to define the colors of each line, which I can do using series and the color attribute. There is nothing like an order or a fix number by which I can predefine the colors. So I want to create an array of attributes parallel to my colors and just place it at series=myColors . The problem is that gVis expects a string like: series="[{color: 'black', visibleInLegend: false}]", As soon as I create a string using the paste function

Iterate over pandas series

独自空忆成欢 提交于 2019-12-06 23:59:16
问题 I want to travel round the series index In [44]: type(ed1) Out[44]: pandas.core.series.Series In [43]: for _, row in ed1.iterrows(): ...: print(row.name) and I get thie error: AtributeError: 'Series' ojbect has no attribute 'iterrows' Is series has any methods like iterrows? thank a lot 回答1: Series objects define an iteritems method (the data is returned as a iterator of index-value pairs. for _, val in ed1.iteritems(): ... Alternatively, you can iterate over a list by calling tolist, for val

OLS with pandas: datetime index as predictor

拥有回忆 提交于 2019-12-06 21:48:10
问题 I would like to use pandas OLS function to fit a trendline to my data Series. Does anyone knows how to use the datetime index from the pandas Series as predictor in the OLS? For example, let say that I have a simple time series: >>> ts 2001-12-31 19.828763 2002-12-31 20.112191 2003-12-31 19.509116 2004-12-31 19.913656 2005-12-31 19.701649 2006-12-31 20.022819 2007-12-31 20.103024 2008-12-31 20.132712 2009-12-31 19.850609 2010-12-31 19.290640 2011-12-31 19.936210 2012-12-31 19.664813 Freq: A

Pandas: pad series on top or bottom

陌路散爱 提交于 2019-12-06 15:52:03
This turned out to be non-trivial for me so I wanted to check if others have a simple solution for this: Suppose I have an arbitrary number (say 3) of pd.Series : which look like: first = pd.Series(range(5)) second = pd.Series(range(7)) third = pd.Series(range(6)) I'd like to make them all of the same length (7 -- which is the largest length) and pad the shorter ones with np.nan s either at the top (optionally at the bottom) so that first looks like: nan nan 0 1 2 3 4 and so on. You could use reindex to give each Series a new index. If the new index contains labels which are not in the