-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
BUG: raise TypeError when array not like 1D in pandas.array #63210
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
base: main
Are you sure you want to change the base?
Conversation
|
@Alvaro-Kothe If I have done some mistake or any change is required, please tell me. |
Alvaro-Kothe
left a comment
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.
This time, I have used np.array() for it to be time efficient like the _from_sequence method.
There are some benchmarks for array construction in asv_bench/benchmarks/array.py that you can use to measure performance impact. For guidance on how to run it, refer to the docs.
pandas/core/construction.py
Outdated
|
|
||
| # to avoid returning an array of string representation of objects. | ||
| if dtype == StringDtype(): | ||
| ndarr = np.array(data) |
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.
I don't like this for the following reasons:
- It's weird to convert to
np.arraywhile callingpd.arrayand not use it. - The conversion in
np.arraycan raise, e.g., when we callnp.array([[1, 2], ["a"]]).
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.
Is this change alright? Do I need to make any changes?
Alvaro-Kothe
left a comment
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.
Can you run the benchmarks?
I ran the benchmarks. The last commit has decreased the efficiency. Sorry for that. |
pandas.arrayworks fine when 2-D array contains string #63112Follows from #63173. I'm Sorry, but the last commit of the PR showed "Processing updates" for a long time. So, I closed that.