@@ -123,9 +123,9 @@ They can take a number of arguments:
123
123
Because it has to essentially scan through the data again, this causes a
124
124
significant performance hit so only use if necessary.
125
125
- ``lineterminator `` : string (length 1), default ``None ``, Character to break file into lines. Only valid with C parser
126
- - ``quotechar `` : string, The character to used to denote the start and end of a quoted item.
126
+ - ``quotechar `` : string, The character to used to denote the start and end of a quoted item.
127
127
Quoted items can include the delimiter and it will be ignored.
128
- - ``quoting `` : int,
128
+ - ``quoting `` : int,
129
129
Controls whether quotes should be recognized. Values are taken from `csv.QUOTE_* ` values.
130
130
Acceptable values are 0, 1, 2, and 3 for QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONE, and QUOTE_NONNUMERIC, respectively.
131
131
- ``skipinitialspace `` : boolean, default ``False ``, Skip spaces after delimiter
@@ -147,9 +147,9 @@ They can take a number of arguments:
147
147
- ``verbose ``: show number of NA values inserted in non-numeric columns
148
148
- ``squeeze ``: if True then output with only one column is turned into Series
149
149
- ``error_bad_lines ``: if False then any lines causing an error will be skipped :ref: `bad lines <io.bad_lines >`
150
- - ``usecols ``: a subset of columns to return, results in much faster parsing
150
+ - ``usecols ``: a subset of columns to return, results in much faster parsing
151
151
time and lower memory usage.
152
- - ``mangle_dupe_cols ``: boolean, default True, then duplicate columns will be specified
152
+ - ``mangle_dupe_cols ``: boolean, default True, then duplicate columns will be specified
153
153
as 'X.0'...'X.N', rather than 'X'...'X'
154
154
- ``tupleize_cols ``: boolean, default True, if False, convert a list of tuples
155
155
to a multi-index of columns, otherwise, leave the column index as a list of tuples
@@ -783,8 +783,8 @@ to do as before:
783
783
os.remove(' foo.csv' )
784
784
785
785
786
- Reading DataFrame objects with ``MultiIndex ``
787
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
786
+ Reading an index with a ``MultiIndex ``
787
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
788
788
789
789
.. _io.csv_multiindex :
790
790
@@ -795,7 +795,8 @@ Suppose you have data indexed by two columns:
795
795
print open (' data/mindex_ex.csv' ).read()
796
796
797
797
The ``index_col `` argument to ``read_csv `` and ``read_table `` can take a list of
798
- column numbers to turn multiple columns into a ``MultiIndex ``:
798
+ column numbers to turn multiple columns into a ``MultiIndex `` for the index of the
799
+ returned object:
799
800
800
801
.. ipython :: python
801
802
@@ -805,12 +806,12 @@ column numbers to turn multiple columns into a ``MultiIndex``:
805
806
806
807
.. _io.multi_index_columns :
807
808
808
- Specifying a multi-index columns
809
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
809
+ Reading columns with a `` MultiIndex ``
810
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
810
811
811
812
By specifying list of row locations for the ``header `` argument, you
812
- can read in a multi-index for the columns. Specifying non-consecutive
813
- rows will skip the interveaing rows.
813
+ can read in a `` MultiIndex `` for the columns. Specifying non-consecutive
814
+ rows will skip the interveaning rows.
814
815
815
816
.. ipython :: python
816
817
@@ -820,8 +821,8 @@ rows will skip the interveaing rows.
820
821
print open (' mi.csv' ).read()
821
822
pd.read_csv(' mi.csv' ,header = [0 ,1 ,2 ,3 ],index_col = [0 ,1 ],tupleize_cols = False )
822
823
823
- Note: The default behavior in 0.12 remains unchanged (``tupleize_cols=True ``),
824
- but starting with 0.12 , the default *to * write and read multi-index columns will be in the new
824
+ Note: The default behavior in 0.12 remains unchanged (``tupleize_cols=True ``) from prior versions ,
825
+ but starting with 0.13 , the default *to * write and read multi-index columns will be in the new
825
826
format (``tupleize_cols=False ``)
826
827
827
828
Note: If an ``index_col `` is not specified (e.g. you don't have an index, or wrote it
@@ -958,7 +959,7 @@ Read and write ``JSON`` format files.
958
959
959
960
Writing JSON
960
961
~~~~~~~~~~~~
961
-
962
+
962
963
A ``Series `` or ``DataFrame `` can be converted to a valid JSON string. Use ``to_json ``
963
964
with optional parameters:
964
965
@@ -1100,7 +1101,7 @@ I like my string indicies
1100
1101
si.index
1101
1102
si.columns
1102
1103
json = si.to_json()
1103
-
1104
+
1104
1105
sij = pd.read_json(json,convert_axes = False )
1105
1106
sij
1106
1107
sij.index
@@ -1433,18 +1434,18 @@ And then import the data directly to a DataFrame by calling:
1433
1434
1434
1435
clipdf
1435
1436
1436
- The ``to_clipboard `` method can be used to write the contents of a DataFrame to
1437
- the clipboard. Following which you can paste the clipboard contents into other
1437
+ The ``to_clipboard `` method can be used to write the contents of a DataFrame to
1438
+ the clipboard. Following which you can paste the clipboard contents into other
1438
1439
applications (CTRL-V on many operating systems). Here we illustrate writing a
1439
1440
DataFrame into clipboard and reading it back.
1440
1441
1441
1442
.. ipython :: python
1442
-
1443
+
1443
1444
df= pd.DataFrame(randn(5 ,3 ))
1444
1445
df
1445
1446
df.to_clipboard()
1446
1447
pd.read_clipboard()
1447
-
1448
+
1448
1449
We can see that we got the same content back, which we had earlier written to the clipboard.
1449
1450
1450
1451
.. note ::
@@ -1510,7 +1511,7 @@ advanced strategies
1510
1511
xls = ExcelFile(' path_to_file.xls' )
1511
1512
xls.parse(' Sheet1' , index_col = None , na_values = [' NA' ])
1512
1513
1513
- Replaced by
1514
+ Replaced by
1514
1515
1515
1516
.. code-block :: python
1516
1517
@@ -2430,7 +2431,7 @@ Writing to STATA format
2430
2431
2431
2432
.. _io.stata_writer:
2432
2433
2433
- The method :func:`~ pandas.core.frame.DataFrame.to_stata` will write a DataFrame
2434
+ The method :func:`~ pandas.core.frame.DataFrame.to_stata` will write a DataFrame
2434
2435
into a .dta file . The format version of this file is always the latest one, 115 .
2435
2436
2436
2437
.. ipython:: python
@@ -2458,9 +2459,9 @@ converting them to a DataFrame which is returned:
2458
2459
2459
2460
Currently the `` index`` is retrieved as a column on read back.
2460
2461
2461
- The parameter `` convert_categoricals`` indicates wheter value labels should be
2462
- read and used to create a `` Categorical`` variable from them. Value labels can
2463
- also be retrieved by the function `` variable_labels`` , which requires data to be
2462
+ The parameter `` convert_categoricals`` indicates wheter value labels should be
2463
+ read and used to create a `` Categorical`` variable from them. Value labels can
2464
+ also be retrieved by the function `` variable_labels`` , which requires data to be
2464
2465
called before (see `` pandas.io.stata.StataReader`` ).
2465
2466
2466
2467
The StataReader supports .dta Formats 104 , 105 , 108 , 113 - 115 .
@@ -2471,7 +2472,7 @@ Alternatively, the function :func:`~pandas.io.stata.read_stata` can be used
2471
2472
2472
2473
import os
2473
2474
os.remove(' stata.dta' )
2474
-
2475
+
2475
2476
Data Reader
2476
2477
---------- -
2477
2478
0 commit comments