Skip to content

DataFrame.interpolate() failes with complex dtype #18009

Closed
@jennirinker

Description

@jennirinker

MWE

import numpy as np
import pandas as pd

df = pd.DataFrame(np.random.rand(3,2), dtype=complex)
df.iloc[1,:] = np.nan
print(df)
print()
print(df.interpolate())

Problem description

Calling interpolate() on a pandas dataframe with complex data returns the same dataframe, still with NaNs present. It would be nice if pd.interpolate() either
a) copied NumPy's interpolation functionality for complex numbers or
b) threw a warning that interp doesn't work for complex numbers

Expected Output

I would expect the interpolate method to replace the NaNs in my dataframe with the lineraly interpolated values.

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
INSTALLED VERSIONS

commit: None
python: 3.6.1.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: en
LOCALE: None.None

pandas: 0.20.3
pytest: 3.2.1
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.25.2
numpy: 1.13.1
scipy: 0.19.0
xarray: 0.9.6
IPython: 6.1.0
sphinx: 1.6.3
patsy: None
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.6.2
feather: None
matplotlib: 2.0.2
openpyxl: 2.4.8
xlrd: 1.0.0
xlwt: 1.3.0
xlsxwriter: 1.0.0
lxml: None
bs4: None
html5lib: 0.999
sqlalchemy: 1.1.13
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugComplexComplex NumbersMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions