0

I have been trying to convert the following heterogeneous csv-data (presented below as dataframe)

    Date        Animal    Kg food
0   01-01-20    Zebra       5
1   01-01-20    Lion        5
2   01-01-20    Elephant    20
3   02-01-20    Lion        3
4   02-01-20    Elephant    10
5   03-01-20    Zebra       3
6   03-01-20    Lion        9
7   03-01-20    Dog         2

into more of homogeneous data using pandas.

enter image description here

Points to note:

  1. For any given date not all animals are given food (as shown in figure above). Therefore they are not in the csv data. However, I would like to add 0 there to make it homogeneous.
  2. I would like to have animals in 'column' alphabetically.

Any help on this will be appreciated. Thanks..

0 Answers0