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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
49 views

Adding Contact Numbers to Dataframe by Weight

This function is intended to add phone numbers to a "Phone" column in the "data" dataframe by weight, using account number as the primary key. Weights (descending): home phone ...
Spencer's user avatar
0 votes
1 answer
36 views

Visual Studio .NET Chart Bug

This post is about what I think is a VS bug. The issue is about the view the Chart gives when I load as DataSource a single-row query result with these columns DATE MYDATE double LIABILITIES double ...
sickboy's user avatar
  • 11
0 votes
1 answer
59 views

Why series over NumPy arrays? [closed]

Series are labeled 1d array and we have arrays in NumPy in general. Why should I use one over the other? Also I came across these statements while looking for answers: Pandas Series are designed to ...
uzuiii's user avatar
  • 21
0 votes
0 answers
39 views

Prove or disprove the infinite series of functions and normal functions in big-O [closed]

1.Let f1(n),f2(n)...fn(n)...be an infinite series of functions. fi(n) belongs to O(n) for all i. Let g(k)=sigma(j=1 to k)fj(j) (i.e. g(1)=f1(1),g(2)=f1(1)+f2(2)) then g(n) belongs to O(n^2) 2.Let fi(n)...
Eric Chen's user avatar
0 votes
0 answers
5 views

Remove Axis From Bar Chart [duplicate]

I am making a bar chart that looks like this: How do I remove the "Average Count" label seen in the upper left? See code below: # Create a DataFrame for plotting months = ["January"...
user19251203's user avatar
0 votes
1 answer
14 views

Reorder Series Data Based on Month

I have a data frame with the following data: month April 4484.900000 August 5664.419355 December 3403.806452 February 2655.298246 January 2176.338710 July 5563.677419 ...
user19251203's user avatar
-1 votes
0 answers
17 views

Create a column counting matches from another column in Python [duplicate]

I have a data frame that looks something like this: id hospital 1 a 2 b 3 a 4 c 5 c 6 c 7 d 8 b I want to add a column that reflects how many times a value appears in the hospital column and ...
Dennis Bucklin's user avatar
0 votes
1 answer
17 views

how to access pine script previous series value when supplying values to security.request() call

Consider the following simple pine script: //@version=5 indicator("TestScript", "TestScript", true) smaRes = ta.sma(close,1) htf = "1D" offset=-1 var smaResHi = 0.0 ...
OJNSim's user avatar
  • 738
2 votes
2 answers
48 views

Python pandas replace the values of a DataFrame by searching in another DataFrame with non-identical labels

I have two dataframes. df1 contains CITIES and the total number of VISITS. df2 contains the VISITS records. Periodically df1 is updated with the data from df2 with the new VISITS. df1 example (before ...
Gustavo's user avatar
  • 35
0 votes
1 answer
47 views

Trying to solve error messages for a Pinescript indicator

I keep getting error messages writing the code for an indicator. I would like it to print a triangle when four conditions become true. `Condition 1 = 20ema crossunder 100ema 3 bars ago Condition 2 = ...
M H Sham's user avatar
0 votes
1 answer
39 views

How do I join the following list of series based on series name?

I have two object series, one before and one after, grouped by name. I generated them from the following code: beforeseries = dfbefore.groupby('name', dropna=True)['order'].apply(list) print(...
JTA1618's user avatar
  • 35
0 votes
0 answers
14 views

How do I remove the decimal .0 arbitrarily inserted after numbers now in a dataframe or series? [duplicate]

I imported an Excel file with a column called Zip for Zip Codes. I then tried to use this . .value_counts() to count the zip codes, but the result was a series that added .0 to the ending of every zip ...
AndIamEm's user avatar
1 vote
1 answer
42 views

Python Pandas apply a string splitting function to an index [duplicate]

I have a Pandas DataFrame containing Postcodes and counts. It has been created using value_count. The DataFrame looks like this: count Postcode AL1 1AJ 151 AL1 1AR 36 AL1 1AS ...
FreelanceConsultant's user avatar
0 votes
1 answer
21 views

How to merge two `value_counts` results without data loss? [duplicate]

I want to accumulate value counts, but the simple addition does not do the trick. Suppose I have many many Series, e.g., : a = pd.Series([1,2,2,None], dtype=object) b = pd.Series([3,2,2,None], dtype=...
sds's user avatar
  • 58.7k
-1 votes
1 answer
56 views

Let x_0 = 0 and let x_1, x_2, ..., x_10 follow the rule |x_i - x_{i-1}| = 1 for 1 <= i <= 10. If x_10 = 4, how many possible sequences are there? [closed]

At each node, we must go up or down 1. A couple of possible sequences would be 0,1,2,3,2,3,2,3,2,3,4 or 0,-1,-2,1,2,3,4,5,4,3,4 I saw this question on QuantGuide I have come across this problem and I ...
Jacob Holmes's user avatar
0 votes
0 answers
14 views

Cant call 'strategy.entry' with argument 'alert_message'. An argument of '[literal string, literal string]' type was used but 'series string' expected

Within a strategy entry I would like to use an alert_message consisting of multiple "texts/webhook messages" preferrably devided by a ','. Very new to this. Any help would be greatly ...
J stap's user avatar
  • 1
0 votes
0 answers
14 views

How can I adjust the visibility order of different series on a Combo Chart, specifically getting a line to appear above candlesticks?

I am using a Candlestick plot to show a distribution of a few different data sets. I am trying to have two trend lines show overtop of the Candlesticks, but they are consistently appearing behind it ...
J.G.'s user avatar
  • 1
0 votes
1 answer
32 views

Split a data frame column containing sequences of value pairs into two columns separating those pairs

I have a data frame with 2 columns. One is the source text, the other is sequences of (keyword, score) pairs generated by KeyBERT from the source, for example: [('white butterfly', 0.4587), ('pest ...
SlowBear's user avatar
0 votes
0 answers
17 views

AttributeError when trying to use the append function for DataFrame [duplicate]

Im trying to add a Series to my DataFrame with the append funtion. I'm not trying to permanently change the DataFrame, this is just for study purposes. I get a traceback that 'DataFrame' object has no ...
TheHoodbaby's user avatar
1 vote
2 answers
36 views

How can i re-order column name in dataframe

I am practicing python code and reach to manipluation part where i tend to change order of the columns : Here is my code : import pandas as pd data= {"calories":[420, 380, 390], &...
Mahdi Al Aradi's user avatar
1 vote
1 answer
52 views

sum two Pandas Series with count events and different rows

I am trying to merge two pandas.Series with different datetime but have some problem to get proper values in the final merge. I saw some posts where they keep both series in a dataframe but I would ...
Kodsama's user avatar
  • 131
0 votes
2 answers
207 views

pinescript to get weekly close price's as series from daily timeframe chart

I am trying to extract weekly close prices from daily chart or daily secuirty-call (request.security(syminfo.ticker , "D", screener_func()) in tradingview. Based on timeframe change(W), i am ...
jkr's user avatar
  • 630
-1 votes
1 answer
44 views

How to remove Freq: MS, Name: des, dtype: int64 from pandas series?

I have some pandas series like result_ses. I wanted to accumulate all the data into a dictionary and save the data in a csv. I am using Google Colab to work. But I am facing trouble removing some of ...
raiyan22's user avatar
  • 1,043
0 votes
0 answers
64 views

A pandas column better to have object or string dtype?

When I look the pandas column type, when I placed strings inside, the dtype returned was object. My dataframe will be read-only, it means that I don't mind if the type is a s(size). And I see on this ...
DazzRick's user avatar
0 votes
0 answers
49 views

Selectively running function on multiple pandas series depending on function input condition

I have a function to calculate future payments on a loan. The function signature looks something like: calculate_payment(rate: pd.Series, remaining_term: pd.Series, remaining_balance: pd.Series) I ...
Rebecca Qin's user avatar
-2 votes
1 answer
40 views

Why pandas boolean series needs () to work with boolean operators? [duplicate]

I've seen that if you pass a boolean series to a dataframe of the same length as rows in the dataframe it filters the dataframe. However, if we pass a condition instead of a boolean series (like df['...
Eugenio.Gastelum96's user avatar
0 votes
2 answers
28 views

Series versus dataframe

I've just begun learning some pandas, so apologies if I'm not the best at explaining my question. # creating a range of times starting from '1/1/1' going forward hourly for 100 units. longTimeRange = ...
Donna_Tartare's user avatar
1 vote
1 answer
49 views

Why can't I use Series values within a DataFrame lambda calculation?

I'm trying to create a basic function that takes three Series objects and returns a DataFrame with one column of values, similar to the example values below. The Series objects used as parameters in ...
OKprogrammer's user avatar
0 votes
2 answers
39 views

split a string from a list in a Pandas series

I have a series of geographic coordinates as below and am fairly new to Series. I need to extract the latitude and longitude from these coordinates into separate series to concatenate back into the ...
Cord's user avatar
  • 317
0 votes
2 answers
48 views

What am I doing wrong with my code for Mclaurin Series Expansion?

(https://i.stack.imgur.com/3LgGA.png) I have been trying to make a code in c++ for the Mclaurin ’s Series expansion of sin(x), as a review for my Intro to Programming class and my results are always ...
smh21's user avatar
  • 1
0 votes
2 answers
33 views

merge 2 series with different indexes [duplicate]

I have 2 series with different indexes but the same length of 638. series fc's output is 1888 4.899912 1889 4.900162 1890 4.900141 1891 4.900142 1892 4.900142 ... 2521 4....
Aayush Kaushal's user avatar
0 votes
1 answer
51 views

How can i union two pd.Series efficiently

I have two sorted pd.Series like A = [1, 3, 5, 7] B = [3, 4, 5, 8, 10] I'd like to union them to get a new list C = [1, 3, 4, 5, 7, 8, 10] The following code can solve it. A = pd.Series([1, 3, 5, 7],...
user1521062's user avatar
0 votes
2 answers
48 views

Index values in Pandas Series

Consider the following code: my_series = pd.Series(np.arange(3)) my_series[-1] The above code snippet generates a Key Error, when trying to retrieve a value. However, when we specify a custom index ...
meKafka's user avatar
  • 55
1 vote
2 answers
322 views

Why am I getting an error when using 'squeeze' keyword in 'read_csv'?

alcohol = pd.read_csv('https://andybek.com/pandas-drinks', usecols=['country','wine_servings'], index_col='country', squeeze=True) When using the keyword squeeze to convert a one columned dataframe ...
Ashutosh Bhoi's user avatar
0 votes
1 answer
17 views

Indexing pandas series with bracket operator: Different behaviour for integer or non-integer index [duplicate]

When exploring indexing pandas.Series I encountered the following inconsistency: When I have a a pd.Series with an integer index, I can access a value with the bracket operator + index LABEL. When I ...
monkei's user avatar
  • 28
0 votes
0 answers
14 views

arithmetic on simple pandas data frame (time series)

I am having a pandas data frame called dj. Its index column is a series of days, from 01/01/2021 to 01/01/2025. I am trying to create a time series of historical flow concatenated with forecasted flow....
Jessica Gervais's user avatar
0 votes
2 answers
27 views

Printing the following series in python

Print the following pattern in Python: 20,19,18...1 for x in range (21,2): x=x-1 print(x) but when I execute it, the output window comes blank whenever I execute it. I checked the indents too,...
Lizi's user avatar
  • 3
1 vote
1 answer
34 views

How to compare two elements of a series with different indexes

I have two series of integers ('high' and 'low') with the same length and I want to compare all values of 'low' against all values of 'high' which are in a position prior to the value of 'low' being ...
kace84's user avatar
  • 13
0 votes
1 answer
46 views

The truth value of a series is ambiguous, when I made a calculation on a loop on Python

I have the following loop: max_potential = 100 for indx, values in geography.sort_values(district)[neighborhood].items(): population = geography_clusters[geography_clusters['neighborhood']==indx]['...
SmackCat's user avatar
0 votes
1 answer
33 views

Convert Pandas Series/DF which has xml in each cell to form multiple columns?

I have a messy dataset which has parameters from an application contained in a single cell when read in a pandas series. For instance, parameters |<data>| <parameters>| | ...
Snive's user avatar
  • 17
1 vote
1 answer
29 views

Can't visualise time series correctly in Python

I have a problem visualising time series in the format D/M/Y h/m/s The following code works for the first day and produces incorrect output after that. import pandas as pd import matplotlib.pyplot as ...
Rally Dr's user avatar
-1 votes
1 answer
38 views

How to change type of Pandas Series of vectors from str to numerical?

I do have a Series that consists of fixed-sized vectors, but as str. How can I change this series' type to a numerical vector? Here is the preview of this serie: p.s. The provided answers in a ...
talha06's user avatar
  • 6,236
0 votes
1 answer
82 views

'Series' object has no attribute 'corrwith'

How do I fix this error? corr15=log_returns15.corrwith(market_log_returns15) --------------------------------------------------------------------------- AttributeError ...
Lethabo's user avatar
-2 votes
1 answer
107 views

How to fix error: Unhashable type: 'Series'?

Below is the dictionary I have created, flag = {'No': 0, 'N': 0, 'Y': 1, 'Yes': 1} New_Product_Launch = flag[ final_input_optimization[ (final_input_optimization['Brand'] == ...
Mihika Malhotra's user avatar
0 votes
1 answer
45 views

In pandas, how is it possible for a Boolean series of len(100) to be applied to a dataframe of len(10) without it throwing an error?

Apologies for not being able to provide the data. Somebody else wrote this code, and I don't understand how it's working. There's a dataframe (df) that's say, 100 samples long. They grouped it: [EDIT ...
NaiveBae's user avatar
  • 358
0 votes
1 answer
35 views

How to make one-liner `pd.Series` with `pd.CategoricalIndex` property

I have a one-liner liner code that is working, which from pd.DataFrame create pd.Series with an index pd.CategoricalIndex. Since pd.DataFrame is an API based on pd.Series I would like to generate the ...
Andrei.Danciuc's user avatar
1 vote
2 answers
43 views

Changing xticks to the name of the months

i have a multilevel index series whose outer level index is month and inner level index is day let say it is stored in series print(series) Please see the output->output So to make plot i use the ...
 Mohd yousuf khan's user avatar
0 votes
0 answers
25 views

Subtracting a Series from a DataFrame

df2 = pd.DataFrame(np.arange(9).reshape(3,3), columns=['a','b','c'], index=['car','bike','cycle']) print(df2) a b c car 0 1 2 bike 3 4 5 cycle 6 7 8 ser_c= df2.loc['car'] print(...
newuser_'s user avatar
1 vote
1 answer
50 views

Using df.loc[] vs df[] shorthand with boolean masks, pandas

Both df[booleanMask] and df.loc[booleanMask] are working for me but I don't understand why. The shorthand df[] without using .loc I thought applied to the column whereas I am trying to apply to the ...
Deano's user avatar
  • 13
1 vote
1 answer
24 views

Change one dataframe values to another based on a condition and when they have different lengths

I have 2 dataframes: df1 = {'Yes/No': ['Yes', 'No', 'No', 'No'], 'ID': [11, 22, 33, 44], 'Expiration': ['2023', '2022', '2022', '2024'], 'Code': ['B11', 'A11', 'D11', 'C11'], 'Number': [303, 202, 301, ...
dom159's user avatar
  • 23

1
2 3 4 5
72