The wrong answer is B. We can use s.append(s1) to directly append s1 to the existing series s. See example below.
import pandas as pd
import numpy as np
#create and print first series
data = np.array(['a','b','c','d'])
s = pd.Series(data,index=[100,101,102,103])
print('First series: \n',s)
print()
#create and print second series
data = {'a' : 0., 'b' : 1., 'c' : 2.}
s1 = pd.Series(data)
print('Second series: \n',s1)
print()
#append and print combined series
print('Appended series: \n',s.append(s1))
Answer. B.
Comments
Leave a comment