-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: slice before constructing JoinUnit #52542
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks good.
Thanks @jbrockmendel |
It looks like this PR made a change in behaviour (for the best): import pandas as pd
arr1 = [1.0, '1', 'Allen, Miss. Elisabeth Walton', 'female', 29.0, 0.0, 0.0, '24160', 211.3375, 'B5', 'S', '2', None, 'St Louis, MO']
arr2 = [
[1.0, '1', 'Allison, Master. Hudson Trevor', 'male', 0.9167, 1.0, 2.0, '113781', 151.55, 'C22 C26', 'S', '11', None, 'Montreal, PQ / Chesterville, ON'],
[1.0, '0', 'Allison, Miss. Helen Loraine', 'female', 2.0, 1.0, 2.0, '113781', 151.55, 'C22 C26', 'S', None, None, 'Montreal, PQ / Chesterville, ON'],
[1.0, '0', 'Allison, Mr. Hudson Joshua Creighton', 'male', 30.0, 1.0, 2.0, '113781', 151.55, 'C22 C26', 'S', None, 135.0, 'Montreal, PQ / Chesterville, ON']
pd.concat([pd.DataFrame([arr1]), pd.DataFrame(arr2)], ignore_index=True)
] The previous code would output:
while
Looking at column 12, the dtype has changed from However, it introduces an inconsistency between In [6]: pd.concat([pd.DataFrame([[None]]), pd.DataFrame([[None], [None], [1.0]])], ignore_index=True)
Out[6]:
0
0 NaN
1 NaN
2 NaN
3 1.0
In [7]: pd.concat([pd.Series([None]), pd.Series([None, None, 1.0])], ignore_index=True)
Out[7]:
0 None
1 NaN
2 NaN
3 1.0
dtype: object I don't know until which point some of the behaviour could be considered as breaking change here. |
@jbrockmendel might be good to have a follow up with a unit test and whatsnew entry about this change |
I'm seeing small speedups in the case from #50652, not as much as I had hoped for. The main upside is significantly simplifying JoinUnit.