@@ -438,27 +438,26 @@ def crosstab(index, columns, values=None, rownames=None, colnames=None,
438
438
439
439
Examples
440
440
--------
441
- >>> a
442
- array([foo, foo, foo, foo, bar, bar,
443
- bar, bar, foo, foo, foo], dtype=object)
444
- >>> b
445
- array([one, one, one, two, one, one,
446
- one, two, two, two, one], dtype=object)
447
- >>> c
448
- array([dull, dull, shiny, dull, dull, shiny,
449
- shiny, dull, shiny, shiny, shiny], dtype=object)
441
+ >>> a = np.array(["foo", "foo", "foo", "foo", "bar", "bar",
442
+ ... "bar", "bar", "foo", "foo", "foo"], dtype=object)
443
+ >>> b = np.array(["one", "one", "one", "two", "one", "one",
444
+ ... "one", "two", "two", "two", "one"], dtype=object)
445
+ >>> c = np.array(["dull", "dull", "shiny", "dull", "dull", "shiny",
446
+ ... "shiny", "dull", "shiny", "shiny", "shiny"],
447
+ ... dtype=object)
450
448
451
449
>>> crosstab(a, [b, c], rownames=['a'], colnames=['b', 'c'])
452
- b one two
453
- c dull shiny dull shiny
450
+ ... # doctest: +NORMALIZE_WHITESPACE
451
+ b one two
452
+ c dull shiny dull shiny
454
453
a
455
- bar 1 2 1 0
456
- foo 2 2 1 2
454
+ bar 1 2 1 0
455
+ foo 2 2 1 2
457
456
458
457
>>> foo = pd.Categorical(['a', 'b'], categories=['a', 'b', 'c'])
459
458
>>> bar = pd.Categorical(['d', 'e'], categories=['d', 'e', 'f'])
460
459
>>> crosstab(foo, bar) # 'c' and 'f' are not represented in the data,
461
- # but they still will be counted in the output
460
+ ... # but they still will be counted in the output
462
461
col_0 d e f
463
462
row_0
464
463
a 1 0 0
0 commit comments