@@ -2185,13 +2185,13 @@ argument to ``to_excel`` and to ``ExcelWriter``. The built-in engines are:
2185
2185
2186
2186
df.to_excel(' path_to_file.xlsx' , sheet_name = ' Sheet1' )
2187
2187
2188
+ .. _io.excel_writing_buffer :
2189
+
2188
2190
Writing Excel Files to Memory
2189
2191
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2190
2192
2191
2193
.. versionadded :: 0.17
2192
2194
2193
- .. _io.excel_writing_buffer
2194
-
2195
2195
Pandas supports writing Excel files to buffer-like objects such as ``StringIO `` or
2196
2196
``BytesIO `` using :class: `~pandas.io.excel.ExcelWriter `.
2197
2197
@@ -2412,7 +2412,7 @@ for some advanced strategies
2412
2412
2413
2413
.. warning ::
2414
2414
2415
- As of version 0.17.0, ``HDFStore `` will not drop rows that have all missing values by default. Previously, if all values (except the index) were missing, ``HDFStore `` would not write those rows to disk.
2415
+ As of version 0.17.0, ``HDFStore `` will not drop rows that have all missing values by default. Previously, if all values (except the index) were missing, ``HDFStore `` would not write those rows to disk.
2416
2416
2417
2417
.. ipython :: python
2418
2418
:suppress:
@@ -2511,7 +2511,7 @@ similar to how ``read_csv`` and ``to_csv`` work. (new in 0.11.0)
2511
2511
os.remove(' store_tl.h5' )
2512
2512
2513
2513
2514
- As of version 0.17.0, HDFStore will no longer drop rows that are all missing by default. This behavior can be enabled by setting ``dropna=True ``.
2514
+ As of version 0.17.0, HDFStore will no longer drop rows that are all missing by default. This behavior can be enabled by setting ``dropna=True ``.
2515
2515
2516
2516
.. ipython :: python
2517
2517
:suppress:
@@ -2520,16 +2520,16 @@ As of version 0.17.0, HDFStore will no longer drop rows that are all missing by
2520
2520
2521
2521
.. ipython :: python
2522
2522
2523
- df_with_missing = pd.DataFrame({' col1' :[0 , np.nan, 2 ],
2523
+ df_with_missing = pd.DataFrame({' col1' :[0 , np.nan, 2 ],
2524
2524
' col2' :[1 , np.nan, np.nan]})
2525
2525
df_with_missing
2526
2526
2527
- df_with_missing.to_hdf(' file.h5' , ' df_with_missing' ,
2527
+ df_with_missing.to_hdf(' file.h5' , ' df_with_missing' ,
2528
2528
format = ' table' , mode = ' w' )
2529
-
2529
+
2530
2530
pd.read_hdf(' file.h5' , ' df_with_missing' )
2531
2531
2532
- df_with_missing.to_hdf(' file.h5' , ' df_with_missing' ,
2532
+ df_with_missing.to_hdf(' file.h5' , ' df_with_missing' ,
2533
2533
format = ' table' , mode = ' w' , dropna = True )
2534
2534
pd.read_hdf(' file.h5' , ' df_with_missing' )
2535
2535
@@ -2547,16 +2547,16 @@ This is also true for the major axis of a ``Panel``:
2547
2547
[[np.nan, np.nan, np.nan], [np.nan,5 ,6 ]],
2548
2548
[[np.nan, np.nan, np.nan],[np.nan,3 ,np.nan]]]
2549
2549
2550
- panel_with_major_axis_all_missing = Panel(matrix,
2550
+ panel_with_major_axis_all_missing = Panel(matrix,
2551
2551
items = [' Item1' , ' Item2' ,' Item3' ],
2552
2552
major_axis = [1 ,2 ],
2553
2553
minor_axis = [' A' , ' B' , ' C' ])
2554
2554
2555
2555
panel_with_major_axis_all_missing
2556
2556
2557
2557
panel_with_major_axis_all_missing.to_hdf(' file.h5' , ' panel' ,
2558
- dropna = True ,
2559
- format = ' table' ,
2558
+ dropna = True ,
2559
+ format = ' table' ,
2560
2560
mode = ' w' )
2561
2561
reloaded = read_hdf(' file.h5' , ' panel' )
2562
2562
reloaded
@@ -3224,8 +3224,7 @@ Notes & Caveats
3224
3224
``PyTables `` only supports concurrent reads (via threading or
3225
3225
processes). If you need reading and writing *at the same time *, you
3226
3226
need to serialize these operations in a single thread in a single
3227
- process. You will corrupt your data otherwise. See the issue
3228
- (:`2397 `) for more information.
3227
+ process. You will corrupt your data otherwise. See the (:issue: `2397 `) for more information.
3229
3228
- If you use locks to manage write access between multiple processes, you
3230
3229
may want to use :py:func: `~os.fsync ` before releasing write locks. For
3231
3230
convenience you can use ``store.flush(fsync=True) `` to do this for you.
@@ -3256,34 +3255,19 @@ DataTypes
3256
3255
``HDFStore `` will map an object dtype to the ``PyTables `` underlying
3257
3256
dtype. This means the following types are known to work:
3258
3257
3259
- - floating : ``float64, float32, float16 `` *(using * ``np.nan `` *to
3260
- represent invalid values) *
3261
- - integer : ``int64, int32, int8, uint64, uint32, uint8 ``
3262
- - bool
3263
- - datetime64[ns] *(using * ``NaT `` *to represent invalid values) *
3264
- - object : ``strings `` *(using * ``np.nan `` *to represent invalid
3265
- values) *
3266
-
3267
- Currently, ``unicode `` and ``datetime `` columns (represented with a
3268
- dtype of ``object ``), **WILL FAIL **. In addition, even though a column
3269
- may look like a ``datetime64[ns] ``, if it contains ``np.nan ``, this
3270
- **WILL FAIL **. You can try to convert datetimelike columns to proper
3271
- ``datetime64[ns] `` columns, that possibly contain ``NaT `` to represent
3272
- invalid values. (Some of these issues have been addressed and these
3273
- conversion may not be necessary in future versions of pandas)
3274
-
3275
- .. ipython :: python
3276
-
3277
- import datetime
3278
- df = DataFrame(dict (datelike = Series([datetime.datetime(2001 , 1 , 1 ),
3279
- datetime.datetime(2001 , 1 , 2 ), np.nan])))
3280
- df
3281
- df.dtypes
3282
-
3283
- # to convert
3284
- df[' datelike' ] = Series(df[' datelike' ].values, dtype = ' M8[ns]' )
3285
- df
3286
- df.dtypes
3258
+ ====================================================== =========================
3259
+ Type Represents missing values
3260
+ ====================================================== =========================
3261
+ floating : ``float64, float32, float16 `` ``np.nan ``
3262
+ integer : ``int64, int32, int8, uint64,uint32, uint8 ``
3263
+ boolean
3264
+ ``datetime64[ns] `` ``NaT ``
3265
+ ``timedelta64[ns] `` ``NaT ``
3266
+ categorical : see the section below
3267
+ object : ``strings `` ``np.nan ``
3268
+ ====================================================== =========================
3269
+
3270
+ ``unicode `` columns are not supported, and **WILL FAIL **.
3287
3271
3288
3272
.. _io.hdf5-categorical :
3289
3273
@@ -3813,22 +3797,22 @@ connecting to.
3813
3797
3814
3798
.. code-block :: python
3815
3799
3816
- from sqlalchemy import create_engine
3800
+ from sqlalchemy import create_engine
3817
3801
3818
- engine = create_engine(' postgresql://scott:tiger@localhost:5432/mydatabase' )
3802
+ engine = create_engine(' postgresql://scott:tiger@localhost:5432/mydatabase' )
3819
3803
3820
- engine = create_engine(' mysql+mysqldb://scott:tiger@localhost/foo' )
3804
+ engine = create_engine(' mysql+mysqldb://scott:tiger@localhost/foo' )
3821
3805
3822
- engine = create_engine(' oracle://scott:[email protected] :1521/sidname' )
3806
+ engine = create_engine(' oracle://scott:[email protected] :1521/sidname' )
3823
3807
3824
- engine = create_engine(' mssql+pyodbc://mydsn' )
3808
+ engine = create_engine(' mssql+pyodbc://mydsn' )
3825
3809
3826
- # sqlite://<nohostname>/<path>
3827
- # where <path> is relative:
3828
- engine = create_engine(' sqlite:///foo.db' )
3810
+ # sqlite://<nohostname>/<path>
3811
+ # where <path> is relative:
3812
+ engine = create_engine(' sqlite:///foo.db' )
3829
3813
3830
- # or absolute, starting with a slash:
3831
- engine = create_engine(' sqlite:////absolute/path/to/foo.db' )
3814
+ # or absolute, starting with a slash:
3815
+ engine = create_engine(' sqlite:////absolute/path/to/foo.db' )
3832
3816
3833
3817
For more information see the examples the SQLAlchemy `documentation <http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html >`__
3834
3818
@@ -3939,8 +3923,8 @@ will produce the dictionary representation of the schema.
3939
3923
3940
3924
.. code-block :: python
3941
3925
3942
- df = pandas.DataFrame({' A' : [1.0 ]})
3943
- gbq.generate_bq_schema(df, default_type = ' STRING' )
3926
+ df = pandas.DataFrame({' A' : [1.0 ]})
3927
+ gbq.generate_bq_schema(df, default_type = ' STRING' )
3944
3928
3945
3929
.. warning ::
3946
3930
@@ -4145,14 +4129,16 @@ This is an informal comparison of various IO methods, using pandas 0.13.1.
4145
4129
4146
4130
.. code-block :: python
4147
4131
4148
- In [3 ]: df = DataFrame(randn(1000000 ,2 ),columns = list (' AB' ))
4132
+ In [1 ]: df = DataFrame(randn(1000000 ,2 ),columns = list (' AB' ))
4133
+
4134
+ In [2 ]: df.info()
4149
4135
< class ' pandas.core.frame.DataFrame' >
4150
4136
Int64Index: 1000000 entries, 0 to 999999
4151
4137
Data columns (total 2 columns):
4152
- A 1000000 non- null values
4153
- B 1000000 non- null values
4138
+ A 1000000 non- null float64
4139
+ B 1000000 non- null float64
4154
4140
dtypes: float64(2 )
4155
-
4141
+ memory usage: 22.9 MB
4156
4142
4157
4143
Writing
4158
4144
0 commit comments