Can `open` ever return, like, multiple files?
liamhuber opened this issue · 2 comments
I was playing around in pyiron_atomistics.lammps.output
for #1143, and I found this snippet:
with open(file_name, "r") as f:
...
dfs = []
for l in f:
... # Nothing with dfs
dfs.append(pd.read_csv(...))
if len(dfs) == 1:
df = dfs[0]
else:
df = pd.concat[dfs]
This looks super weird to me -- how is it possible that dfs
can ever be anything other than length 1? I don't see anything in pandas.read_csv about returning multiple values, but even if it did I would still expect len(dfs) == 1
even if len(dfs[0]) != 1
... Is this code just redundant?
pd.concat[dfs]
would immediately throw an error, so I don't think it was ever triggered. Ok to cut it imo.
pd.concat[dfs]
would immediately throw an error, so I don't think it was ever triggered. Ok to cut it imo.
Super. This was my suspicion, but since this is supposed to be a pure refactor I wanted a second opinion before deleting so many lines!