(no title)
qwhelan | 6 years ago
Simply a matter of default type of join - join defaults to left while merge defaults to inner. They use the exact same internal join logic.
>What if they're optional? pd.DataFrame({'foo': [1,2,3,None]}) will silently change your integers to floating point values.
This was a long standing issue but is no longer true.
>Want to check if a dataframe is empty? Unlike lists or dicts, trying to turn a dataframe into a truth value will throw ValueError.
Those are 1D types where that's simple to reason about. It's not as straightforward in higher dimensions (what's the truth value of a (0, N) array?), which is why .empty exists
jfim|6 years ago
No, join does an index merge. For example, if you try to join with string keys, it'll throw an error (because strings and numeric indexes aren't compatible).
If you try to join with numeric keys: Or even worse if your numeric values are within the range for indexes, which kind of looks right if you're not paying attention: Whereas merge does what one would expect: >> What if they're optional? pd.DataFrame({'foo': [1,2,3,None]}) will silently change your integers to floating point values.> This was a long standing issue but is no longer true.
Occurs in pandas 0.25.1 (and the release notes for 0.25.2 and 0.25.3 don't mention such a change), so that would likely be still the case in the latest stable release.
It's also a lossy conversion if the integer values are large enough: >> Want to check if a dataframe is empty? Unlike lists or dicts, trying to turn a dataframe into a truth value will throw ValueError.> Those are 1D types where that's simple to reason about. It's not as straightforward in higher dimensions (what's the truth value of a (0, N) array?), which is why .empty exists
It's not very pythonic, though. A definition of "all dimensions greater than 0" would've been much less surprising.
qwhelan|6 years ago
It was released in 0.24.0: https://pandas.pydata.org/pandas-docs/stable/user_guide/inte...
For example: