Skip to content

Commit

Permalink
Fixed concatenation of pandas indexes (+ operator deprecated)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dvalters committed Apr 12, 2018
1 parent e659077 commit 7341986
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyspecchio/parser_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def file_and_dict_name(dirname, fname):

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

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

dfs = extract_dataframes()
dfs = extract_dataframes(self.DATADIR)
# Could be the other way round I suppose...
for bad_string in BAD_STRINGS:
self.assertFalse(any(bad_string in key for key in dfs.keys()))
Expand Down

0 comments on commit 7341986

Please sign in to comment.