From ff52ee1d9d7bb11e40f7cfc39424c59aa59cf5c6 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 17 Apr 2024 13:56:09 +0200 Subject: [PATCH] MNT: Address deprecation warning in CI FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead The sep parameter has been available since Pandas 1.0 at least. --- niworkflows/interfaces/utility.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/niworkflows/interfaces/utility.py b/niworkflows/interfaces/utility.py index fdca1f23a5b..4521af9116a 100644 --- a/niworkflows/interfaces/utility.py +++ b/niworkflows/interfaces/utility.py @@ -251,8 +251,7 @@ class AddTSVHeader(SimpleInterface): >>> addheader.inputs.in_file = 'data.tsv' >>> addheader.inputs.columns = ['a', 'b', 'c', 'd', 'e'] >>> res = addheader.run() - >>> df = pd.read_csv(res.outputs.out_file, delim_whitespace=True, - ... index_col=None) + >>> df = pd.read_csv(res.outputs.out_file, sep='\s+', index_col=None) >>> df.columns.ravel().tolist() ['a', 'b', 'c', 'd', 'e'] @@ -311,7 +310,7 @@ class JoinTSVColumns(SimpleInterface): >>> join.inputs.in_file = 'data.tsv' >>> join.inputs.join_file = 'add.tsv' >>> res = join.run() - >>> df = pd.read_csv(res.outputs.out_file, delim_whitespace=True, + >>> df = pd.read_csv(res.outputs.out_file, sep='\s+', ... index_col=None, dtype=float, header=None) >>> df.columns.ravel().tolist() == list(range(5)) True @@ -328,8 +327,7 @@ class JoinTSVColumns(SimpleInterface): >>> res = join.run() >>> res.outputs.out_file # doctest: +ELLIPSIS '...data_joined.tsv' - >>> df = pd.read_csv(res.outputs.out_file, delim_whitespace=True, - ... index_col=None) + >>> df = pd.read_csv(res.outputs.out_file, sep='\s+', index_col=None) >>> df.columns.ravel().tolist() ['a', 'b', 'c', 'd', 'e'] @@ -342,8 +340,7 @@ class JoinTSVColumns(SimpleInterface): >>> join.inputs.side = 'left' >>> join.inputs.columns = ['a', 'b', 'c', 'd', 'e'] >>> res = join.run() - >>> df = pd.read_csv(res.outputs.out_file, delim_whitespace=True, - ... index_col=None) + >>> df = pd.read_csv(res.outputs.out_file, sep='\s+', index_col=None) >>> df.columns.ravel().tolist() ['a', 'b', 'c', 'd', 'e']