2
How do I add a new value to a pandas series?
I made the copy of the dataframe series and now I need to add a new value to the series swap_hoje
, but instead of being at the end of the series, I need it to be at the beginning, in the index 0
.
swap_hoje = swap_dataframe['Valor'].reset_index(drop=True)
I also need to add a value to the series swap_ontem
:
swap_ontem = swap_dataframe['Valor'].reset_index(drop=True)
However, the latter will have to be at the end of the series.
In fact, what your code does is replace the value of position 0, right? I believe I didn’t express myself clearly! I need a new value to be inserted in heading 0, and the old value of heading 0 to heading 1 and so on.
– Matheus
It’s like if you gave an append, only instead of the new value entering at the end of the series, it enters at the beginning!
– Matheus
I got it, actually I just didn’t pay enough attention, so... there goes a new version.
– Sidon
See if the new version meets.
– Sidon