setitem type coercion fails when setting a datetime column in a single row dataframe #14179
Labels
Bug
Datetime
Datetime data dtype
Duplicate Report
Duplicate issue or pull request
Indexing
Related to indexing on series/frames, not to indexes themselves
xref #6942
xref #12499
Exception:
/Users//anaconda/lib/python2.7/site-packages/pandas/core/internals.py in _try_coerce_args(self, values, other)
2103 other_mask = isnull(other)
2104
-> 2105 other = other.astype('i8', copy=False).view('i8')
2106 except ValueError:
2107
TypeError: long() argument must be a string or a number, not 'datetime.datetime'
Incidentally, df1['b'] = [datetime.datetime.now()] will work, but i'm avoiding that as the performance is so poor when it's a copy (in my particular case the copy is dead and gc.collect(2) gets called for each column set operation, blowing out the runtime to 3x what it was pre-copy checking - should I open a separate issue for that?).
pd.show_versions():
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Darwin
OS-release: 12.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
pandas: 0.18.1
nose: 1.3.7
pip: 8.1.1
setuptools: 20.3
Cython: 0.23.4
numpy: 1.10.4
scipy: 0.17.0
statsmodels: 0.6.1
xarray: None
IPython: 5.1.0
sphinx: 1.3.5
patsy: 0.4.0
dateutil: 2.5.1
pytz: 2016.2
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.5
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.8.4
lxml: 3.6.0
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.39.0
pandas_datareader: None
The text was updated successfully, but these errors were encountered: