Skip to content

Commit 7341986

Browse files
committed
Fixed concatenation of pandas indexes (+ operator deprecated)
The Index set operations + and - were deprecated in order to provide these for numeric type operations on certain index types. + can be replaced by .union() or |, and - by .difference(). Further the method name Index.diff() is deprecated and can be replaced by Index.difference() (GH8226) pandas-dev/pandas#8226
1 parent e659077 commit 7341986

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pyspecchio/parser_pandas.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def file_and_dict_name(dirname, fname):
3030

3131
def extract_dataframes(directory):
3232
for (dirname, subdirs, files) in os.walk(directory):
33-
# print('[' + dirname + ']')
3433
for fname in files:
3534
# Only match "xlsx" files, exclude recovery/backup files
3635
if re.match("^(?![~$]).*.xlsx$", fname):
@@ -51,7 +50,8 @@ def extract_excel_format(filefullname, dictname):
5150
upper_header = pd.MultiIndex.from_product([['Sample1', 'Sample2',
5251
'Sample3', 'Sample4', 'Sample5', 'PlotAverage'],
5352
['Fo', 'Fv', 'Fm', 'Fv/Fm', 'Fv/Fo']])
54-
new_header = dataframes[dictname].columns[0:3] + upper_header
53+
import pdb; pdb.set_trace()
54+
new_header = dataframes[dictname].columns[0:3].union(upper_header)
5555
dataframes[dictname].columns = new_header
5656
if dictname in dataframes:
5757
# Perhaps log as well if duplicate
@@ -122,7 +122,7 @@ def test_correct_files_parsed(self):
122122

123123
BAD_STRINGS = ['$', '~', 'csv', 'xls']
124124

125-
dfs = extract_dataframes()
125+
dfs = extract_dataframes(self.DATADIR)
126126
# Could be the other way round I suppose...
127127
for bad_string in BAD_STRINGS:
128128
self.assertFalse(any(bad_string in key for key in dfs.keys()))

0 commit comments

Comments
 (0)