Python 使用StyleFrame从excel中读取
我在读取文件和循环列时出错Python 使用StyleFrame从excel中读取,python,pandas,styleframe,Python,Pandas,Styleframe,我在读取文件和循环列时出错 sf = sf[[col for col in sf.columns if col.style.fill.fgColor.rgb in ('FFFFFFFF', utils.colors.white)]] 我希望在读取excel时不丢失样式值这是StyleFrame中的一个错误,原因是[col for coll in sf.columns if col.style.fill.fgColor.rgb in('ffffffffffff',utils.c
sf = sf[[col for col in sf.columns
if col.style.fill.fgColor.rgb in ('FFFFFFFF', utils.colors.white)]]
我希望在读取excel时不丢失样式值这是StyleFrame中的一个错误,原因是
[col for coll in sf.columns if col.style.fill.fgColor.rgb in('ffffffffffff',utils.colors.white)]
返回一个空列表(即,每个列的条件都是False
)
这将在下一版本中修复
临时解决办法:
return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'columns'
问题中的代码与Excel有什么关系?能否提供
import StyleFrame的输出;打印(StyleFrame.\u版本)
?Python 2.7(r27:82525,2010年7月4日,09:01:59)[MSC v.1500 32位(英特尔)]0.19.0 openpyxl 2.2.5 StyleFrame 1.3。1@SureshK谢谢,终于重现了。看到我的答案了吗?非常感谢。我会检查一下,很快告诉你
required_cols = [col for col in sf.columns
if col.style.fill.fgColor.rgb in ('FFFFFFFF', utils.colors.white)]
sf = sf[required_cols] if required_cols else StyleFrame(pd.DataFrame(columns=sf.columns))