0
I created the function below that returns me three data frames:
def top_share(x, y, z):
x['SHARE-N'] = x.SHARE_VALOR
y['SHARE-P'] = y.SHARE_VALOR
z['SHARE-3C'] = z.SHARE_VALOR
x_top = x[['DESC', 'SHARE-N']]
y_top = y[['DESC', 'SHARE-P']]
z_top = z[['DESC', 'SHARE-3C']]
top_share1 = x_top.groupby('DESC').mean().sort_values('SHARE-N', ascending=False).head(10)
top_share2 = y_top.groupby('DESC').mean().sort_values('SHARE-P', ascending=False).head(10)
top_share3 = z_top.groupby('DESC').mean().sort_values('SHARE-3C', ascending=False).head(10)
return pd.DataFrame(top_share1), pd.DataFrame(top_share2), pd.DataFrame(top_share3)
As in the three data frames created the columns DESC have a great descriptive the only way I can visualize them integers would be in data frame form, I would like the function me returns a single data frame with 6 columns, I can’t use Skype because they don’t have a common thread and when I try to use Skype it gives me an error saying that :
AttributeError: 'tuple' object has no attribute 'join'
I also tried to create a return of the kind:
return pd.DataFrame(top_share1 + top_share2 + top_share3)
But it returns me a data frame with all share columns with Nan.