PythonDataScienceHandbook icon indicating copy to clipboard operation
PythonDataScienceHandbook copied to clipboard

check on 03.05 in notebooks_v1

Open maxvolpi opened this issue 2 years ago • 1 comments

I think that in the paragraph on Explicit MultiIndex constructors che code:

pd.MultiIndex(levels=[['a', 'b'], [1, 2]], labels=[[0, 0, 1, 1], [0, 1, 0, 1]])

should be replaced with:

pd.MultiIndex(levels=[['a', 'b'], [1, 2]], codes=[[0, 0, 1, 1], [0, 1, 0, 1]])

Could you please check. It worked on my computer with codes, but I got the error message:

pd.MultiIndes.new() got an unexpected keywor argument for "labels"

maxvolpi avatar Sep 12 '23 14:09 maxvolpi

The pd.MultiIndex constructor better use the codes parameter instead of labels to specify the levels and labels for a MultiIndex object. and it should work as expected without any errors.

Moataz-Elmesmary avatar Sep 13 '23 09:09 Moataz-Elmesmary