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
26
votes
6 answers

How to check if a pandas dataframe contains only numeric values column-wise?

I want to check every column in a dataframe whether it contains only numeric data. Specifically, my query is not about the datatype, but instead, I want to check every value in each column of the dataframe whether it's a numeric value. How can I…
Raja Sahe S
  • 587
  • 1
  • 7
  • 13
26
votes
2 answers

df.append() is not appending to the DataFrame

I formulated this question about adding rows WITH index, but it is not yet clear to me how/why this happens when there are no indexes: columnsList=['A','B','C','D'] df8=pd.DataFrame(columns=columnsList) L=['value aa','value bb','value cc','value…
JFerro
  • 3,203
  • 7
  • 35
  • 88
26
votes
13 answers

Which programming language or a library can process Infinite Series?

Which programming language or a library is able to process infinite series (like geometric or harmonic)? It perhaps must have a database of some well-known series and automatically give proper values in case of convergence, and maybe generate an…
psihodelia
  • 29,566
  • 35
  • 108
  • 157
25
votes
2 answers

How do I change the index values of a Pandas Series?

How can I change the index values of a Pandas Series from the regular integer value that they default to, to values within a list that I have? e.g. x = pd.Series([421, 122, 275, 847, 175]) index_values = ['2014-01-01', '2014-01-02', '2014-01-03',…
Eugene_Harold
  • 373
  • 1
  • 3
  • 6
25
votes
2 answers

AttributeError: 'Series' object has no attribute 'iterrows'

accounts = pd.read_csv('C:/*******/New_export.txt', sep=",", dtype={'number': object}) accounts.columns = ["Number", "F"] for i, j in accounts["Number"].iterrows(): #i represents the row(index number), j is the number if (str(j) ==…
Kusi
  • 785
  • 1
  • 10
  • 21
24
votes
3 answers

How do I turn a dataframe into a series of lists?

I have had to do this several times and I'm always frustrated. I have a dataframe: df = pd.DataFrame([[1, 2, 3, 4], [5, 6, 7, 8]], ['a', 'b'], ['A', 'B', 'C', 'D']) print df A B C D a 1 2 3 4 b 5 6 7 8 I want to turn df…
Brian
  • 1,555
  • 3
  • 16
  • 23
24
votes
2 answers

Removing elements from pandas series in python

I have a series data type which was generated by subtracting two columns from pandas data frame. I want to remove the first element from the series which would be x[-1] in R. I can get it to work in np array class but series class doesn't work.
jay2020
  • 451
  • 1
  • 3
  • 12
24
votes
2 answers

Remove rows of zeros from a Pandas series

I have a number Pandas Series with 601 rows indexed by date as seen below. The values are zero up until a point, after which all the values are non zero. This point varies with each Series but I would like a way to remove all the rows where the…
BLL27
  • 921
  • 5
  • 13
  • 27
24
votes
4 answers

Are there functions to retrieve the histogram counts of a Series in pandas?

There is a method to plot Series histograms, but is there a function to retrieve the histogram counts to do further calculations on top of it? I keep using numpy's functions to do this and converting the result to a DataFrame or Series when I need…
Rafael S. Calsaverini
  • 13,582
  • 19
  • 75
  • 132
24
votes
5 answers

How to prevent my stacked series from being in reverse order?

I tried an example of stacked series on JSFiddle but according to me, series are reversed when stacked: $(function () { $('#container').highcharts({ chart: { }, xAxis: { categories: ['Jan', 'Feb', 'Mar',…
keskispas
  • 255
  • 1
  • 3
  • 5
23
votes
5 answers

python pandas.Series.isin with case insensitive

I want to filter out some rows with one of DataFrame's column which data is in a list. df[df['column'].isin(mylist)] But I found that it's case sensitive. Is there any method using ".isin()" with case insensitive?
haoping
  • 255
  • 1
  • 2
  • 7
23
votes
4 answers

Generate series 1, 2,1, 3,2,1, 4,3,2,1, 5,4,3,2,1

I am trying to generate a vector containing decreasing sequences of increasing length, such as 1, 2,1, 3,2,1, 4,3,2,1, 5,4,3,2,1, i.e. c(1, 2:1, 3:1, 4:1, 5:1) I tried to use a loop for this, but I don't know how to stack or concatenate the…
FFB
  • 255
  • 2
  • 7
22
votes
3 answers

How to extract values from pandas Series without index

I have the following when I print my data structure: print(speed_tf) 44.0 -24.4 45.0 -12.2 46.0 -12.2 47.0 -12.2 48.0 -12.2 Name: Speed, dtype: float64 I believe this is a pandas Series but not sure I do not want the first column at all…
wwjdm
  • 2,568
  • 7
  • 32
  • 61
22
votes
6 answers

Replace multiple substrings in a Pandas series with a value

All, To replace one string in one particular column I have done this and it worked fine: dataUS['sec_type'].str.strip().str.replace("LOCAL","CORP") I would like now to replace multiple strings with one string say replace ["LOCAL", "FOREIGN",…
SBad
  • 1,245
  • 5
  • 23
  • 36
22
votes
3 answers

Pandas, concat Series to DF as rows

I attempting to add a Series to an empty DataFrame and can not find an answer either in the Doc's or other questions. Since you can append two DataFrames by row or by column it would seem there must be an "axis marker" missing from a Series. …
Dick Eshelman
  • 1,103
  • 2
  • 12
  • 17