Statistics, Machine Learning, Data Science, Financial Planning, Python.
create a corresponding group label data = np.array(group1 + group2 + group3) labels = ['Group1'] * len(group1) + ['Group2'] * len(group2) + ['Group3'] * len(group3) # Create a DataFrame for the data df = pd.DataFrame({'data': data, 'group': labels}) df.head() data group 0 23 Group1 1 25 Group1 2 28