Home > Enterprise >  Grouping data with python
Grouping data with python

Time:12-14

I'm new to python and I'm trying to bundle data from two dataframes but I don't get the expected result. The data are as follows:

data = {'Code':['xxy','zzy','rrf','ado'], 
        'Service':["23a","22c","21d","24o"],
        'Service2':["44e", "32c","85a","26f"],
        'Service3':["42e", "32z","8m","2c"],
       }

df = pd.DataFrame(data)
df
days = {'Services':['23a','23a','44e','zzy', "8m", "8m", "8m", "26f", "8m", "2c", "24o", "26f" ], 
        'Type days':["Monday","Tuesday","Tuesday","Wednesday", "Tuesday", "Wednesday", "Monday", "Tuesday", "Monday", "Wednesday", "Monday", "Tuesday"]
       }
df2 = pd.DataFrame(days)
df2

I would like to get something like this, enter image description here

further when you remove the rows with NAN values you will get

df4.dropna( inplace=True)

enter image description here

so you may need to work on your input data to get expected result.

  • Related