Skip to content

Error : Invalid type promotion #12599

Closed
Closed
@TulyOpt

Description

@TulyOpt

Code Sample

import pandas as pd

def main():

df1 = pd.Series() #dtype = float64
df1["a"] = pd.Timestamp("2014-01-02") #dtype = datetime64
df1["b"] = "z" # OK ! => dtype = object
df1["c"] = 3.0 # OK! => dtype = object

df2 = pd.Series() #dtype = float64
df2["a"] = pd.Timestamp("2014-01-02") #dtype = datetime64
df2["c"] = 3.0 #BOOM !! => TypeError: invalid type promotion
df2["b"] = "z"

if name == "main":
main()

output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Windows
OS-release: 8.1
machine: AMD64
processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.17.1
nose: 1.3.7
pip: 8.0.2
setuptools: 19.6.2
Cython: 0.23.4
numpy: 1.10.4
scipy: 0.17.0
statsmodels: 0.6.1
IPython: 4.0.3
sphinx: 1.3.1
patsy: 0.4.0
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.4.6
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.8.4
lxml: 3.5.0
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.11
pymysql: None
psycopg2: None
Jinja2: 2.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDtype ConversionsUnexpected or buggy dtype conversionsIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions