From 2 series objects, which contain dogs colors I try to create 1 DataFrame object where each column is a dogs breed, and each row a color.
I've transformed 2 series objects into data_frame objects and grouped each on color.
poodle = pd.Series(['grey', 'grey', 'white', 'white', 'black', 'black'])
shihtzu = pd.Series(['grey', 'white', 'white', 'white', 'white', 'black'])
poodle = poodle.to_frame()
poodle.columns = ['poodle_color']
poodle = poodle.groupby('poodle_color').poodle_color.count().to_frame()
shihtzu = shihtzu.to_frame()
shihtzu.columns = ['shihtzu_color']
shihtzu = shihtzu.groupby('shihtzu_color').shihtzu_color.count().to_frame()
dogs = pd.merge(
poodle,
shihtzu,
left_on='poodle_color',
right_on='shihtzu_color', suffixes=['poodle', 'shihtzu'])
print(dogs)
Expected result should look like this:
Actual output is: Empty DataFrame Columns: [poodle_color, shihtzu_color] Index: []