From 4db9a614711a2e52f9c827a9340e7ff7d1882751 Mon Sep 17 00:00:00 2001 From: Masayuki Igawa Date: Wed, 11 May 2016 15:06:20 +0900 Subject: [PATCH] Fix pandas functions warnings This commit fixes pandas functions warnings. Some of pandas functions such as rolling_mean(), resample(how=xx) are deprecated from v0.18.0. Change-Id: I1465e50821af2aaa77d5458205469c4eec1dab58 Closes-Bug: #1580447 --- openstack_health/test_run_aggregator.py | 10 +++++----- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openstack_health/test_run_aggregator.py b/openstack_health/test_run_aggregator.py index c1d592ca..c242e7a3 100644 --- a/openstack_health/test_run_aggregator.py +++ b/openstack_health/test_run_aggregator.py @@ -76,17 +76,17 @@ def convert_test_runs_list_to_time_series_dict(test_runs_list, resample): numeric_dict, temp_dict = format_output_dicts(df, None) return {'numeric': numeric_dict, 'data': temp_dict} numeric_df = df[df['status'] == 'success'].resample( - base.resample_matrix[resample], how='mean') + base.resample_matrix[resample]).mean() # Drop duplicate or invalid columns del(numeric_df['run_id']) del(df['run_time']) # Interpolate missing data for a smooth avg and std dev temp_numeric_df = numeric_df.interpolate(method='time', limit=20) # Add rolling mean and std dev of run_time to dataframe - numeric_df['avg_run_time'] = pd.rolling_mean(temp_numeric_df['run_time'], - 20) - numeric_df['stddev_run_time'] = pd.rolling_std(temp_numeric_df['run_time'], - 20) + numeric_df['avg_run_time'] = temp_numeric_df['run_time'].rolling( + window=20).mean() + numeric_df['stddev_run_time'] = temp_numeric_df['run_time'].rolling( + window=20).std() numeric_df = numeric_df.dropna(how='all') numeric_dict, temp_dict = format_output_dicts(df, numeric_df) diff --git a/requirements.txt b/requirements.txt index c7fafd20..cd869238 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ SQLAlchemy<1.1.0,>=1.0.10 # MIT flask-jsonpify>=1.5.0 # MIT PyMySQL>=0.6.2 # MIT License python-dateutil>=2.4.2 # BSD -pandas>=0.17.1 # BSD +pandas>=0.18.0 # BSD numpy>=1.7.0 # BSD six>=1.9.0 # MIT pytz>=2013.6 # MIT