I have old code in which I gave a pd.Series object to the write-function and it wrote it into a .tfs file.
With one of the checks, we seem to have broken this "feature". Maybe we should bring it back.
Steps to Reproduce
tfs.write("blubb", pd.Series([1,2,3,4]))
Relevant output
File "/afs/cern.ch/work/j/jdilly/public/venvs/acc-py-editable/src/tfs-pandas/tfs/writer.py", line 102, in write_tfs
validate_frame(data_frame, f"to be written in {tfs_file_path.absolute()}", non_unique_behavior)
File "/afs/cern.ch/work/j/jdilly/public/venvs/acc-py-editable/src/tfs-pandas/tfs/frame.py", line 281, in validate
if data_frame.columns.has_duplicates:
File "/afs/cern.ch/work/j/jdilly/public/venvs/acc-py-editable/lib/python3.9/site-packages/pandas/core/generic.py", line 6296, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'columns'
Possible Fix Implementation
check if pd.Series or try-except Attribute Error or ...
Documentation
Operating System
All
Python Version
3.9
Package Version
3.7.2
Bug Description
I have old code in which I gave a
pd.Series
object to the write-function and it wrote it into a .tfs file. With one of the checks, we seem to have broken this "feature". Maybe we should bring it back.Steps to Reproduce
tfs.write("blubb", pd.Series([1,2,3,4]))
Relevant output
Possible Fix Implementation
check if
pd.Series
or try-except Attribute Error or ...