0 votes
1 view
in Data Science by (17.6k points)

How Do I add a single item to a serialized panda series. I know it's not the most efficient way memory wise, but i still need to do that.

Something along:

>> x = Series()

>> N = 4

>> for i in xrange(N):

>>     x.some_appending_function(i**2)    

>> print x

0 | 0

1 | 1

2 | 4

3 | 9

also, how can i add a single row to a pandas DataFrame?

1 Answer

0 votes
by (37.6k points)

This below code will add a new value to the end of series.

obj = Series([4,7,-5,3])

obj.index=['a', 'b', 'c', 'd']

obj['e'] = 181

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...