Skip to content

BUG, dot product with empty dataframe #13466

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
qian0 opened this issue Jun 16, 2016 · 1 comment
Closed

BUG, dot product with empty dataframe #13466

qian0 opened this issue Jun 16, 2016 · 1 comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Numeric Operations Arithmetic, Comparison, and Logical operations

Comments

@qian0
Copy link

qian0 commented Jun 16, 2016

Dot product of empty dataframe resulted in dataframe filled with zeros.
I thought the expected ones would be empty or NaN?

In [3]: df = pd.DataFrame(index = ['a','b'])

In [4]: srs = pd.Series()

In [5]: df
Out[5]:
Empty DataFrame
Columns: []
Index: [a, b]

In [6]: srs
Out[6]: Series([], dtype: float64)

In [7]: df.dot(srs)
Out[7]:
a 0
b 0
dtype: float64

@jreback
Copy link
Contributor

jreback commented Jun 16, 2016

This is as expected as seen below.

In [2]: df = pd.DataFrame(index = ['a','b'])

In [3]: srs = pd.Series()

In [4]: np.dot(df.values, srs.values)
Out[4]: array([ 0.,  0.])

@jreback jreback closed this as completed Jun 16, 2016
@jreback jreback added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Numeric Operations Arithmetic, Comparison, and Logical operations labels Jun 16, 2016
@jreback jreback added this to the No action milestone Jun 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

No branches or pull requests

2 participants