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

To access a value by position, use ser.iloc[pos] #2750

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def expanding_count(datetime_series):
min_periods=self.min_periods,
).count()
num_nans = self.gap + self.min_periods - 1
count_series[range(num_nans)] = np.nan
count_series.iloc[range(num_nans)] = np.nan
return count_series

return expanding_count
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def test_make_3_stacked_agg_feats(df):
feature_set = FeatureSet([sum_3])
calculator = FeatureSetCalculator(es, time_last=None, feature_set=feature_set)
df = calculator.run(np.array(["z"]))
v = df[sum_3.get_name()][0]
v = df[sum_3.get_name()].iloc[0]
assert v == 5


Expand Down Expand Up @@ -635,7 +635,7 @@ def test_deep_agg_feat_chain(es):
calculator = FeatureSetCalculator(es, time_last=None, feature_set=feature_set)
df = calculator.run(np.array(["United States"]))

v = df[region_avg_feat.get_name()][0]
v = df[region_avg_feat.get_name()].iloc[0]
assert v == 17 / 3.0


Expand Down Expand Up @@ -696,7 +696,7 @@ def test_direct_squared(es):
calculator = FeatureSetCalculator(es, time_last=None, feature_set=feature_set)
df = calculator.run(np.array([0, 1, 2]))
for i, row in df.iterrows():
assert (row[0] * row[0]) == row[1]
assert (row.iloc[0] * row.iloc[0]) == row.iloc[1]


def test_agg_empty_child(es):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_expanding_count_series(window_series, min_periods, gap):
test = window_series.shift(gap)
expected = test.expanding(min_periods=min_periods).count()
num_nans = gap + min_periods - 1
expected[range(num_nans)] = np.nan
expected.iloc[range(num_nans)] = np.nan
primitive_instance = ExpandingCount(min_periods=min_periods, gap=gap).get_function()
actual = primitive_instance(window_series.index)
pd.testing.assert_series_equal(pd.Series(actual), expected)
Expand All @@ -47,7 +47,7 @@ def test_expanding_count_date_range(window_date_range, min_periods, gap):
test = _apply_gap_for_expanding_primitives(gap=gap, x=window_date_range)
expected = test.expanding(min_periods=min_periods).count()
num_nans = gap + min_periods - 1
expected[range(num_nans)] = np.nan
expected.iloc[range(num_nans)] = np.nan
primitive_instance = ExpandingCount(min_periods=min_periods, gap=gap).get_function()
actual = primitive_instance(window_date_range)
pd.testing.assert_series_equal(pd.Series(actual), expected)
Expand Down