Skip to content

DataFrame.interpolate() failes with complex dtype #18009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jennirinker opened this issue Oct 28, 2017 · 3 comments
Closed

DataFrame.interpolate() failes with complex dtype #18009

jennirinker opened this issue Oct 28, 2017 · 3 comments
Labels
Bug Complex Complex Numbers Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

Comments

@jennirinker
Copy link

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

@jreback jreback added Complex Complex Numbers Difficulty Intermediate Numeric Operations Arithmetic, Comparison, and Logical operations labels Oct 28, 2017
@jreback jreback added this to the Next Major Release milestone Oct 28, 2017
@jreback
Copy link
Contributor

jreback commented Oct 28, 2017

we have very little testing for complex dtypes. welcome to add tests and implementatoins!

@jreback
Copy link
Contributor

jreback commented Oct 28, 2017

note that #17927 may also be at play here

@mroeschke mroeschke added the Bug label Apr 3, 2020
@mroeschke mroeschke added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate and removed Numeric Operations Arithmetic, Comparison, and Logical operations labels Jun 12, 2021
@mroeschke mroeschke removed this from the Contributions Welcome milestone Oct 13, 2022
@mroeschke
Copy link
Member

This looks to work on main now and is tested so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Complex Complex Numbers Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

No branches or pull requests

4 participants