Add item to pandas.Series?

前端 未结 3 879
我寻月下人不归
我寻月下人不归 2020-12-15 07:57

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)
         


        
3条回答
  •  不思量自难忘°
    2020-12-15 08:47

    Using set_value generates the warning:

    FutureWarning: set_value is deprecated and will be removed in a future release. Please use .at[] or .iat[] accessors instead

    So you can instead use at like this:

    input.at[input.index[-1]+1]=6
    

提交回复
热议问题