Questions tagged [series]

A Series object represents a data series. This may be represented as the SeriesCollection class (Java, C#) or Series class in Python Pandas.

  • A series is not necessarily plotted on a chart; it can store data point values that are used to perform a calculation from which another series is created and then plotted. More info available on MSDN.

  • This tag is also used in the context of questions on [pandas] Series. See the pandas tag wiki for more details.

Also see:

3544 questions
93
votes
5 answers

HighCharts Hide Series Name from the Legend

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:…
gotqn
  • 42,737
  • 46
  • 157
  • 243
92
votes
5 answers

How to group a Series by values in pandas?

I currently have a pandas Series with dtype Timestamp, and I want to group it by date (and have many rows with different times in each group). The seemingly obvious way of doing this would be something similar to grouped = s.groupby(lambda x:…
Martín Fixman
  • 9,055
  • 9
  • 38
  • 46
92
votes
6 answers

Finding the intersection between two series in Pandas

I have two series s1 and s2 in pandas and want to compute the intersection i.e. where all of the values of the series are common. How would I use the concat function to do this? I have been trying to work it out but have been unable to (I don't want…
user7289
  • 32,560
  • 28
  • 71
  • 88
91
votes
3 answers

Remove NaN from pandas series

Is there a way to remove a NaN values from a panda series? I have a series that may or may not have some NaN values in it, and I'd like to return a copy of the series with all the NaNs removed.
user1802143
  • 14,662
  • 17
  • 46
  • 55
89
votes
4 answers

Getting a list of indices where pandas boolean series is True

I have a pandas series with boolean entries. I would like to get a list of indices where the values are True. For example the input pd.Series([True, False, True, True, False, False, False, True]) should yield the output [0,2,3,7]. I can do it with…
James McKeown
  • 1,284
  • 1
  • 9
  • 14
89
votes
4 answers

Adding a column thats result of difference in consecutive rows in pandas

Lets say I have a dataframe like this A B 0 a b 1 c d 2 e f 3 g h 0,1,2,3 are times, a, c, e, g is one time series and b, d, f, h is another time series. I need to be able to add two columns to the orignal dataframe which is…
AMM
  • 17,130
  • 24
  • 65
  • 77
87
votes
3 answers

Pandas - check if ALL values are NaN in Series

I have a data series which looks like this: print mys id_L1 2 NaN 3 NaN 4 NaN 5 NaN 6 NaN 7 NaN 8 NaN I would like to check is all the values are NaN. My attempt: pd.isnull(mys).all() Output: True Is…
Boosted_d16
  • 13,340
  • 35
  • 98
  • 158
74
votes
7 answers

Is it possible to append Series to rows of DataFrame without making a list first?

I have some data I'm trying to organize into a DataFrame in Pandas. I was trying to make each row a Series and append it to the DataFrame. I found a way to do it by appending the Series to an empty list and then converting the list of Series to a…
O.rka
  • 29,847
  • 68
  • 194
  • 309
71
votes
19 answers

Is there a simple way to change a column of yes/no to 1/0 in a Pandas dataframe?

I read a csv file into a pandas dataframe, and would like to convert the columns with binary answers from strings of yes/no to integers of 1/0. Below, I show one of such columns ("sampleDF" is the pandas dataframe). In [13]:…
Mushu909
  • 1,194
  • 2
  • 11
  • 16
69
votes
11 answers

Plotting CDF of a pandas series in python

Is there a way to do this? I cannot seem an easy way to interface pandas series with plotting a CDF.
wolfsatthedoor
  • 7,163
  • 18
  • 46
  • 90
68
votes
2 answers

Create a set from a series in pandas

I have a dataframe extracted from Kaggle's San Fransico Salaries: https://www.kaggle.com/kaggle/sf-salaries and I wish to create a set of the values of a column, for instance 'Status'. This is what I have tried but it brings a list of all the…
Julio Arriaga
  • 911
  • 1
  • 10
  • 13
67
votes
3 answers

concat series onto dataframe with column name

I want to add a Series (s) to a Pandas DataFrame (df) as a new column. The series has more values than there are rows in the dataframe, so I am using the concat method along axis 1. df = pd.concat((df, s), axis=1) This works, but the new column of…
vaer-k
  • 10,923
  • 11
  • 42
  • 59
67
votes
4 answers

Convert Python list to pandas Series

What is the method to convert a Python list of strings to a pd.Series object? (pandas Series objects can be converted to list using tolist() method--but how to do the reverse conversion?)
Hypothetical Ninja
  • 3,920
  • 13
  • 49
  • 75
65
votes
5 answers

Python Pandas iterate over rows and access column names

I am trying to iterate over the rows of a Python Pandas dataframe. Within each row of the dataframe, I am trying to to refer to each value along a row by its column name. Here is what I have: import numpy as np import pandas as pd df =…
edesz
  • 11,756
  • 22
  • 75
  • 123
59
votes
3 answers

Accessing a Pandas index like a regular column

I have a Pandas DataFrame with a named index. I want to pass it off to a piece off code that takes a DataFrame, a column name, and some other stuff, and does a bunch of work involving that column. Only in this case the column I want to highlight is…
kuzzooroo
  • 6,788
  • 11
  • 46
  • 84