Other articles

  1. MultiIndex.to_frame()


    From a MultiIndex dataframe, determine the total number of elements in the Buyer column for each Vendor.

    What I did

    Let's say we have the following DataFrame:


    >> df = pd.DataFrame(data=
        {'Vendor': ['A', 'A', 'B', 'C', 'C', 'C',
                'D', 'D', 'E', 'E', 'F', 'G', 'G'],      
        'Buyer':['BU1', 'BU3 …
    read more
  2. MultiIndex.set_levels() in pandas

    Problem: A user filed an issue on the pandas repo regarding MultiIndex.set_levels - and it turns out the user had some confusion between the set_levels method and the set_names method for MultiIndex due to the documentation. Hence, the MultiIndex.set_levels documentation was marked by the maintainers for improvements to clarify …

    read more