-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG raise pdep6 warning for loc full setter #56146
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 20 commits
4644c00
da7efad
9e400c2
003b993
3ff469f
e561aa5
cd9408e
58ce78e
6564773
4c345e4
ea51b08
388ded7
14c9ff6
846b529
4f5495c
9c26bb3
3f82a91
874b596
162586c
467742c
5d24fb0
a43b737
24afe06
20c89a2
7a25a86
3240bb9
755ded6
28a731b
27bf409
b1a4777
5b43509
191ce85
428c146
12cd484
cd208ca
3dd4d36
45dd43b
54f3459
96ee0ae
0bc2205
e3b04b7
c81c486
9d604da
c1fa7f3
7b0e3c8
183a609
ee0f35d
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 |
---|---|---|
|
@@ -1790,7 +1790,7 @@ def read( | |
if convert_dates: | ||
for i, fmt in enumerate(self._fmtlist): | ||
if any(fmt.startswith(date_fmt) for date_fmt in _date_formats): | ||
data.iloc[:, i] = _stata_elapsed_date_to_datetime_vec( | ||
data[data.columns[i]] = _stata_elapsed_date_to_datetime_vec( | ||
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. Does stata allow duplicated columns? This is buggy if the answer is yes We have to operate positional, so you want 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. Same for all the other occurrences, I prefer isetitem even if stata disallows duplicated columns |
||
data.iloc[:, i], fmt | ||
) | ||
|
||
|
@@ -1866,7 +1866,7 @@ def _do_convert_missing(self, data: DataFrame, convert_missing: bool) -> DataFra | |
replacements[i] = replacement | ||
if replacements: | ||
for idx, value in replacements.items(): | ||
data.iloc[:, idx] = value | ||
data[data.columns[idx]] = value | ||
return data | ||
|
||
def _insert_strls(self, data: DataFrame) -> DataFrame: | ||
|
@@ -1876,7 +1876,7 @@ def _insert_strls(self, data: DataFrame) -> DataFrame: | |
if typ != "Q": | ||
continue | ||
# Wrap v_o in a string to allow uint64 values as keys on 32bit OS | ||
data.iloc[:, i] = [self.GSO[str(k)] for k in data.iloc[:, i]] | ||
data[data.columns[i]] = [self.GSO[str(k)] for k in data.iloc[:, i]] | ||
return data | ||
|
||
def _do_select_columns(self, data: DataFrame, columns: Sequence[str]) -> DataFrame: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2830,7 +2830,7 @@ def test_dict_data_arrow_column_expansion(self, key_val, col_vals, col_type): | |
) | ||
result = DataFrame({key_val: [1, 2]}, columns=cols) | ||
expected = DataFrame([[1, np.nan], [2, np.nan]], columns=cols) | ||
expected.iloc[:, 1] = expected.iloc[:, 1].astype(object) | ||
expected[expected.columns[1]] = expected.iloc[:, 1].astype(object) | ||
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. isetitem please |
||
tm.assert_frame_equal(result, expected) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,7 +199,7 @@ def f_1(grp): | |
with tm.assert_produces_warning(FutureWarning, match=msg): | ||
result = df.groupby("A").apply(f_1)[["B"]] | ||
e = expected.copy() | ||
e.loc["Tiger"] = np.nan | ||
e["B"] = [3, 5, float("nan")] | ||
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. why is this changing? any reason for 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. indeed, it didn't need to change, thanks |
||
tm.assert_frame_equal(result, e) | ||
|
||
def f_2(grp): | ||
|
@@ -211,7 +211,7 @@ def f_2(grp): | |
with tm.assert_produces_warning(FutureWarning, match=msg): | ||
result = df.groupby("A").apply(f_2)[["B"]] | ||
e = expected.copy() | ||
e.loc["Pony"] = np.nan | ||
e["B"] = [3, float("nan"), 0] | ||
tm.assert_frame_equal(result, e) | ||
|
||
# 5592 revisited, with datetimes | ||
|
Uh oh!
There was an error while loading. Please reload this page.