1
Data1=['A', '1', 'A', '2', 'B', '3', 'C', '4', 'C', '5', 'C', '6', 'C', '7', 'C', '8']

I get the table like this

0           A      1,2

1           B       3

2           C      4, 5, 6….

I want instead of dots to print the remaining numbers.

My current script is :

df_F=pd.DataFrame(np.array(Data1).reshape(size,2),columns=list("AB"))
groupedF=df_F.groupby(['A'])['B'].apply(lambda x: ', '.join(x.astype(str))).reset_index()

Can any one help. Thanks in advance.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Sam
  • 145
  • 11

0 Answers0