Skip to content
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

Consolidate DataFrame.__init__ logic to prepare data before calling super #14614

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d08fba7
Start refactoring DataFrame init
mroeschke Nov 28, 2023
40268bd
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Nov 28, 2023
0969065
Add dataframe reindexing tests, refactor logic
mroeschke Nov 28, 2023
40f2764
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Nov 28, 2023
2fa5f3a
Fix more logic
mroeschke Nov 29, 2023
dde5f97
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Nov 29, 2023
89f9280
Adjust dict logic
mroeschke Nov 29, 2023
a4da710
More bugs in dict and array logic
mroeschke Dec 1, 2023
d5c2bec
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 2, 2023
8a54791
Fix mode initialization, remove working xfail now
mroeschke Dec 2, 2023
210baf8
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 7, 2023
05d001e
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 7, 2023
36b85cc
Clean up tests, fix more bugs
mroeschke Dec 7, 2023
553fe36
Fix more tests, test reindex bug
mroeschke Dec 8, 2023
df8c261
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 8, 2023
5baac4e
Fix dict like to avoid reindexing
mroeschke Dec 8, 2023
9ce0a69
Adjust test_series_data_with_name_with_columns_matching_align
mroeschke Dec 8, 2023
5fcce39
add comments
mroeschke Dec 8, 2023
3f05824
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 9, 2023
84ee164
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 11, 2023
df93b63
Fix some tests and a naming bug
mroeschke Dec 11, 2023
77ab160
pass arguments through colaccessor
mroeschke Dec 11, 2023
4981b05
Remove redundant check
mroeschke Dec 12, 2023
3fdeb87
Adjust test and add another one with defined behavior
mroeschke Dec 12, 2023
dcddf9c
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 12, 2023
03f2e7f
Move all new tests together, reduce diff
mroeschke Dec 12, 2023
ad81d4b
Remove redundant test
mroeschke Dec 12, 2023
261a5e1
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 12, 2023
9bcb768
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 13, 2023
1a7085d
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 14, 2023
baeaa87
Ensure columns are maintained in slicing
mroeschke Dec 14, 2023
3de72e7
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 15, 2023
645cc33
Fix .columns usage, fix for pandas 2.0 in concat
mroeschke Dec 15, 2023
28947b0
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 19, 2023
d1ce06b
Address test failures
mroeschke Dec 19, 2023
2f3c50e
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Dec 20, 2023
c62aaa6
Fix mode
mroeschke Dec 20, 2023
bf9d22f
Merge remote-tracking branch 'upstream/branch-24.02' into ref/datafra…
mroeschke Jan 4, 2024
498fc75
Allow columns to not be an index
mroeschke Jan 4, 2024
1d06e9d
Merge remote-tracking branch 'upstream/branch-24.04' into ref/datafra…
mroeschke Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion python/cudf/cudf/core/column/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -2090,7 +2090,10 @@ def as_column(
if dtype is not None:
data = data.astype(dtype)

elif np.isscalar(arbitrary) and not isinstance(arbitrary, memoryview):
elif arbitrary is None or (
np.isscalar(arbitrary) and not isinstance(arbitrary, memoryview)
):
# TODO: use is_scalar instead of np.isscalar
length = length or 1
if (
(nan_as_null is True)
Expand All @@ -2100,6 +2103,8 @@ def as_column(
arbitrary = None
if dtype is None:
dtype = cudf.dtype("float64")
elif arbitrary is None and dtype is None:
dtype = cudf.dtype("object")

data = as_column(full(length, arbitrary, dtype=dtype))
if not nan_as_null and not is_decimal_dtype(data.dtype):
Expand All @@ -2119,6 +2124,11 @@ def as_column(

arbitrary = np.asarray(arbitrary)

if arbitrary.ndim == 0:
arbitrary = arbitrary.reshape(
1,
)

# Handle case that `arbitrary` elements are cupy arrays
if (
shape
Expand Down
Loading
Loading