-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
PERF: faster placement creating extension blocks from arrays #32856
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
Changes from all commits
b813d2e
6d6e822
ff4eeb6
ca1a5fe
3b0c546
7dfeb19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import numpy as np | ||
|
||
import pandas as pd | ||
from pandas import DataFrame, MultiIndex, Series, Timestamp, date_range | ||
|
||
from .pandas_vb_common import tm | ||
|
@@ -118,4 +119,48 @@ def time_frame_from_range(self): | |
self.df = DataFrame(self.data) | ||
|
||
|
||
class FromArrays: | ||
|
||
goal_time = 0.2 | ||
|
||
def setup(self): | ||
N_rows = 1000 | ||
N_cols = 1000 | ||
self.float_arrays = [np.random.randn(N_rows) for _ in range(N_cols)] | ||
self.sparse_arrays = [ | ||
pd.arrays.SparseArray(np.random.randint(0, 2, N_rows), dtype="float64") | ||
for _ in range(N_cols) | ||
] | ||
self.int_arrays = [ | ||
pd.array(np.random.randint(1000, size=N_rows), dtype="Int64") | ||
for _ in range(N_cols) | ||
] | ||
self.index = pd.Index(range(N_rows)) | ||
self.columns = pd.Index(range(N_cols)) | ||
|
||
def time_frame_from_arrays_float(self): | ||
self.df = DataFrame._from_arrays( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't change this if no other feedback but I don't think you need the assignment here in any of the benchmarks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True (was only mimicking the other benchmarks in this file) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm this is wrong, but yeah can clean this up in a followup (if you want to create a followup issue or PR to do it) |
||
self.float_arrays, | ||
index=self.index, | ||
columns=self.columns, | ||
verify_integrity=False, | ||
) | ||
|
||
def time_frame_from_arrays_int(self): | ||
self.df = DataFrame._from_arrays( | ||
self.int_arrays, | ||
index=self.index, | ||
columns=self.columns, | ||
verify_integrity=False, | ||
) | ||
|
||
def time_frame_from_arrays_sparse(self): | ||
self.df = DataFrame._from_arrays( | ||
self.sparse_arrays, | ||
index=self.index, | ||
columns=self.columns, | ||
verify_integrity=False, | ||
) | ||
|
||
|
||
from .pandas_vb_common import setup # noqa: F401 isort:skip |
Uh oh!
There was an error while loading. Please reload this page.