series

Changing Default Colors of WPFToolkit Chart Control

时光怂恿深爱的人放手 提交于 2019-12-06 14:18:23
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. 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"> <ResourceDictionary> <Style x:Key="DataPointStyle" BasedOn="{StaticResource ColumnSeries1Style}" TargetType="Control" /

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

我的梦境 提交于 2019-12-06 13:45:18
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 header line like From b1af4315d823a2b6659c5b14bc17f7bc61878ef4 (timestamp) and by doing something like git

Return the unmatched rows from the regex pattern

本小妞迷上赌 提交于 2019-12-06 08:26:52
If I have a pandas dataframe that looks like this: Sequence Rating 0 HYHIVQKF 1 1 YGEIFEKF 2 2 TYGGSWKF 3 3 YLESFYKF 4 4 YYNTAVKL 5 5 WPDVIHSF 6 This is the code that I am using the return the rows that match the following pattern: \b.[YF]\w+[LFI]\b pat = r'\b.[YF]\w+[LFI]\b' new_df.Sequence.str.contains(pat) new_df[new_df.Sequence.str.contains(pat)] The above code is returning the rows that match the pattern, but what can I use to return the unmatched rows? Expected Output: Sequence Rating 1 YGEIFEKF 2 3 YLESFYKF 4 5 WPDVIHSF 6 You can just do a negation of your existing Boolean series: df[

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

ぐ巨炮叔叔 提交于 2019-12-06 07:56:01
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 a dataframe about like this: CrimeDateTime FIREARM HANDS KNIFE OTHER UNDEFINED 2016-01-01 11 26 3 11

Append list to pandas DataFrame as new row with index

孤街醉人 提交于 2019-12-06 07:20:54
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=columnList) print(df3) A B C one 1 2 3 After some operations I get the following list: listtwo=[4,5,6] I

how to remove redundant date time when x-axis is incontinuous pandas DatetimeIndex

橙三吉。 提交于 2019-12-06 05:47:35
I want to plot a pandas series which index is incountinuous DatatimeIndex. My code is as follows: import matplotlib.dates as mdates index = pd.DatetimeIndex(['2000-01-01 00:00:00', '2000-01-01 00:01:00', '2000-01-01 00:02:00', '2000-01-01 00:03:00', '2000-01-01 00:07:00', '2000-01-01 00:08:00'], dtype='datetime64[ns]') df = pd.Series(range(6), index=index) print(df) plt.plot(df.index, df.values) plt.gca().xaxis.set_major_formatter(mdates.DateFormatter("%M")) plt.show() The output is: But the result is not what I really want, because 2000-01-01 00:04:00 is also plotted on the image. The desired

Applying lambda function to a pandas rolling window series

。_饼干妹妹 提交于 2019-12-06 04:15:48
I have a function which takes an array and a value, and returns a value. I would like to apply it to my Series s on a rolling basis, so the array is always the rolling window. Here's a minimal example of what I've tried (unsuccessfully), using np.random.choice in place of my real function. I find lots of examples for finding rolling means and other built-in functions, but can't get it to work for my arbitrary lambda function. s = pd.Series([1,2,3,4,5,6,7,8,9]) rolling_window = s.rolling(3) First attempt: new_values = s.apply(lambda x: np.random.choice(rolling_window, size=1)) ValueError: a [a

How to extract hour, minute and second from Series filled with datetime.time values

假如想象 提交于 2019-12-06 02:43:01
问题 Data: 0 09:30:38 1 13:40:27 2 18:05:24 3 04:58:08 4 09:00:09 Essentially what I'd like to do is split this into three columns [hour, minute, second] I've tried the following code but none seem to be working: train_sample.time.hour AttributeError: 'Series' object has no attribute 'hour' train_sample.time.dt.hour AttributeError: Can only use .dt accessor with datetimelike values pd.DatetimeIndex(train_sample.time).hour TypeError: <class 'datetime.time'> is not convertible to datetime This seems

Combining two series in pandas along their index [duplicate]

僤鯓⒐⒋嵵緔 提交于 2019-12-06 01:29:50
问题 This question already has answers here : Combining two Series into a DataFrame in pandas (7 answers) Closed 6 years ago . I have two series in pandas. series 1: id count_1 1 3 3 19 4 15 5 5 6 2 and series 2: id count_2 1 3 3 1 4 1 5 2 6 1 How do I combine the tables along the ids to form the below? id count_1 count_2 1 3 3 3 19 1 4 15 1 5 5 2 6 2 1 回答1: You can use concat: In [11]: s1 Out[11]: id 1 3 3 19 4 15 5 5 6 2 Name: count_1, dtype: int64 In [12]: s2 Out[12]: id 1 3 3 1 4 1 5 2 6 1

suppress Name dtype from python pandas describe

落花浮王杯 提交于 2019-12-05 21:02:38
问题 Lets say I have r = pd.DataFrame({'A':1 , 'B':pd.Series(1,index=list(range(4)),dtype='float32')}) And r['B'].describe()[['mean','std','min','max']] gives an output : mean 1.0 std 0.0 min 1.0 max 1.0 Name: B, dtype: float64 But from the above output , how should I get rid or suppress the last line " Name:B, dtype: float64 " I figured out one way to achieve this x=r['B'].describe()[['mean','std','min','max']] print "mean ",x['mean'],"\nstd ",x['std'],"\nmin ",x['min'],"\nmax ",x['max'] which