Skip to content

Commit 9119641

Browse files
committed
DOC: updated dsinstro.rst
1 parent b7492fe commit 9119641

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

doc/source/dsintro.rst

+13
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,19 @@ From a list of dicts
320320
DataFrame(data2, index=['first', 'second'])
321321
DataFrame(data2, columns=['a', 'b'])
322322
323+
From a dict of tuples
324+
~~~~~~~~~~~~~~~~~~~~~
325+
326+
You can automatically create a multi-indexed frame by passing a tuples dictionary
327+
328+
.. ipython:: python
329+
330+
DataFrame({('a', 'b'): {('A', 'B'): 1, ('A', 'C'): 2},
331+
('a', 'a'): {('A', 'C'): 3, ('A', 'B'): 4},
332+
('a', 'c'): {('A', 'B'): 5, ('A', 'C'): 6},
333+
('b', 'a'): {('A', 'C'): 7, ('A', 'B'): 8},
334+
('b', 'b'): {('A', 'D'): 9, ('A', 'B'): 10}})
335+
323336
.. _basics.dataframe.from_series:
324337

325338
From a Series

doc/source/v0.14.0.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -405,17 +405,17 @@ Deprecations
405405
Enhancements
406406
~~~~~~~~~~~~
407407

408-
- DataFrame and Series will create MultiIndex if passed a list of tuples
408+
- DataFrame and Series will create a MultiIndex object if passed a tuples dict (:issue:`4187`)
409409

410410
.. ipython:: python
411411

412412
Series({('a', 'b'): 1, ('a', 'a'): 0,
413-
('a', 'c'): 2, ('b', 'a'): 3, ('b', 'b'): 4})
414-
pandas.DataFrame({('a', 'b'): {('A', 'B'): 1, ('A', 'C'): 2},
415-
('a', 'a'): {('A', 'C'): 3, ('A', 'B'): 4},
416-
('a', 'c'): {('A', 'B'): 5, ('A', 'C'): 6},
417-
('b', 'a'): {('A', 'C'): 7, ('A', 'B'): 8},
418-
('b', 'b'): {('A', 'D'): 9, ('A', 'B'): 10}})
413+
('a', 'c'): 2, ('b', 'a'): 3, ('b', 'b'): 4})
414+
DataFrame({('a', 'b'): {('A', 'B'): 1, ('A', 'C'): 2},
415+
('a', 'a'): {('A', 'C'): 3, ('A', 'B'): 4},
416+
('a', 'c'): {('A', 'B'): 5, ('A', 'C'): 6},
417+
('b', 'a'): {('A', 'C'): 7, ('A', 'B'): 8},
418+
('b', 'b'): {('A', 'D'): 9, ('A', 'B'): 10}})
419419

420420
- ``DataFrame.to_latex`` now takes a longtable keyword, which if True will return a table in a longtable environment. (:issue:`6617`)
421421
- ``pd.read_clipboard`` will, if 'sep' is unspecified, try to detect data copied from a spreadsheet

0 commit comments

Comments
 (0)