Skip to content

BUG: Adding empty dataframes should result in empty blocks #10181 #10188

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

Merged
merged 1 commit into from
Jun 7, 2015

Conversation

rekcahpassyla
Copy link
Contributor

Fixes #10181

I added a couple of lines to the dataframe test test_operators to assert that adding two empty dataframes returns a dataframe that is equal (both using assert_frame_equal as well as .equals) to an empty dataframe.

I couldn't get vbench to install (I am running on windows) - the error was:

c:\dev\code\opensource\pandas-rekcahpassyla>pip install git+https://github.com/pydata/vbench
You are using pip version 6.0.8, however version 6.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting git+https://github.com/pydata/vbench
  Cloning https://github.com/pydata/vbench to c:\users\redacted\appdata\local\temp\pip-ruiahg-build
fatal: unable to connect to github.com:
github.com[0: 192.30.252.129]: errno=No error

Clone of 'git://github.com/yarikoptic/vbenchtest.git' into submodule path 'vbench/tests/vbenchtest/vbenchtest' failed
  Complete output from command C:\dev\bin\git\cmd\git.exe submodule update --init --recursive -q:

  ----------------------------------------
  Command "C:\dev\bin\git\cmd\git.exe submodule update --init --recursive -q" failed with error code 1 in c:\users\redacted\appdata\local\temp\pip-ruiahg-build

The test suite failed for me in master with 1 failure. The same failure, but no others, were observed when running in my branch.

@@ -5129,6 +5129,11 @@ def test_operators(self):
df = DataFrame({'a': ['a', None, 'b']})
assert_frame_equal(df + df, DataFrame({'a': ['aa', np.nan, 'bb']}))

df = DataFrame()
self.assertTrue((df + df).equals(DataFrame()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add the issue number as a comment.

I would also add a couple of other test, things like

df = DataFrame(columns=['A'])
self.assertTrue((df+df).equals(df)
  • add for an index, but no columns
  • same as above, but specify a dtype='int64'

@jreback jreback added Reshaping Concat, Merge/Join, Stack/Unstack, Explode API Design labels May 21, 2015
@jreback jreback added this to the 0.17.0 milestone May 21, 2015
@rekcahpassyla
Copy link
Contributor Author

Added more tests and comment as suggested

@jreback
Copy link
Contributor

jreback commented May 21, 2015

@rekcahpassyla ok this looks reasonable. pls add a release note to whatsnew/v0.17.0 (you can put in other API changes section).

pls squash as well.

@rekcahpassyla
Copy link
Contributor Author

Added release note and squashed.

@rekcahpassyla
Copy link
Contributor Author

I note the build failure, will have a look.

@rekcahpassyla
Copy link
Contributor Author

I have verified that my latest commit passes the pandas.stats tests (the cause of the build failure). However I haven't squashed it, as I don't know if it would be considered a separate bug (searching the issues list didn't reveal anything). If it is a separate bug, I'm happy to open another issue and cherrypick this commit into another PR.

@rekcahpassyla
Copy link
Contributor Author

Raised #10195 and proposed #10196 to fix the issue causing https://travis-ci.org/pydata/pandas/builds/63544612 to fail.

@jreback jreback modified the milestones: 0.16.2, 0.17.0 Jun 2, 2015
@jreback
Copy link
Contributor

jreback commented Jun 2, 2015

pls rebase this (and move the release note to 0.16.2)

@rekcahpassyla rekcahpassyla force-pushed the empty_df_add branch 2 times, most recently from 5aaed1d to 4f1e43d Compare June 4, 2015 08:31
@jreback
Copy link
Contributor

jreback commented Jun 5, 2015

I think these are some old travis failures. can you rebase on master. ping when green.

@rekcahpassyla
Copy link
Contributor Author

@jreback - It is green

jreback added a commit that referenced this pull request Jun 7, 2015
BUG: Adding empty dataframes should result in empty blocks #10181
@jreback jreback merged commit d24dc4b into pandas-dev:master Jun 7, 2015
@jreback
Copy link
Contributor

jreback commented Jun 7, 2015

thanks!

@rekcahpassyla rekcahpassyla deleted the empty_df_add branch June 16, 2015 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty dataframe not equal to another empty dataframe in 0.16.1
2 participants