Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion doc/source/v0.10.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ API changes
New features
~~~~~~~~~~~~

Datetime64[ns] columns in a DataFrame (or a Series) allow the use of ``np.nan`` to indicate a nan value, in addition to the traditional ``NaT``, or not-a-time. This allows convenient nan setting in a generic way. Furthermore datetime64 columns are created by default, when using ``datetime.datetime`` or ``Timestamp`` objects, rather than default as object dtype.

.. ipython:: python

df = DataFrame(randn(6,2),date_range('20010102',periods=6),columns=['A','B'])
df['timestamp'] = Timestamp('20010103')
df

# datetime64[ns] out of the box
df.get_dtype_counts()

# use the traditional nan, which is mapped to NaT internally
df.ix[2:4,['A','timestamp']] = np.nan
df

HDFStore
~~~~~~~~

Expand Down Expand Up @@ -59,7 +74,7 @@ You can now store ``datetime64`` in data columns

df_mixed = df.copy()
df_mixed['datetime64'] = Timestamp('20010102')
df_mixed.ix[3:4,['A','B']] = np.nan
df_mixed.ix[3:4,['A','B','datetime64']] = np.nan

store.append('df_mixed', df_mixed)
df_mixed1 = store.select('df_mixed')
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4287,9 +4287,9 @@ def applymap(self, func):
applied : DataFrame
"""

# if we have a dtype == 'M8[ns]', provide boxed values
# if we have a datetime64 type, provide boxed values
def infer(x):
if x.dtype == 'M8[ns]':
if com.is_datetime64_dtype(x):
x = lib.map_infer(x, lib.Timestamp)
return lib.map_infer(x, func)
return self.apply(infer)
Expand Down