I want to add an integer to my pandas.Series
Here is my code:
import pandas as pd
input = pd.Series([1,2,3,4,5])
input.append(6)
here is a one-line answer It is dependent on how the array is defined. If we use Series is a one d array. Use the array notation like x[index] = new value
example
import pandas as pd
input = pd.Series([1,2,3,4,5])
newval = 7 # say
input[len(input)] = newval
or use append if the array is being directly defined.
#if input is defined as []
input2 = [1, 2]
#input2[len(input2)] = 3 # does not work
input2.append(3) #works
input2