Commit 33933f13 authored by Nic's avatar Nic
Browse files

update for pint-pandas==0.2

parent fdf1c108
......@@ -85,7 +85,12 @@ def read_excel(fpath, sheet_name=None, engine=DEFAULT_EXCEL_ENGINE):
"""read excel file using pandas"""
df_dict = pd.read_excel(fpath, sheet_name=sheet_name, engine=engine)
# remove any blank lines
return {k: df.dropna(how="all") for k, df in df_dict.items()}
ret = {k: df.dropna(how="all") for k, df in df_dict.items()}
# also clean Unnamed columns
for tab, df in ret.items():
df = df[[c for c in df if not c.startswith("Unnamed: ")]]
ret[tab] = df
return ret
def read_configobj(fpath, sheet_name=None, row_prefix="sniff"):
......
[tool.black]
line-length = 88
target-version = ['py38']
include = '\.pyi?$'
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
)
'''
pandas==1.1.3 # cf. https://github.com/hgrecco/pint-pandas/issues/51 issue
pint==0.16.1
pint-pandas==0.1
pint>=0.17
pint-pandas>=0.2
xlrd
openpyxl
configobj
......
......@@ -379,7 +379,7 @@ def test_IVData_02(datadir):
def test_IVData_03(datadir):
""" make schema a bit more complex: add generic keys """
"""make schema a bit more complex: add generic keys"""
indir, outdir = datadir
data = IVData()
data.read_excel(os.path.join(indir, "test_02.xlsx"))
......@@ -635,7 +635,12 @@ def test_IVData_06_units(datadir):
for tabname in data_imp._data:
df_imp = data_imp.convert_to(tabname) # .pint.to_base_units()
df_si = data_SI.convert_to(tabname) # .pint.to_base_units()
assert pd.testing.assert_frame_equal(df_imp, df_si) is None
assert (
pd.testing.assert_frame_equal(
df_imp.pint.dequantify(), df_si.pint.dequantify()
)
is None
)
# -------------------------------------------------------------------------
# getunits
assert data_SI.getunits("pressure", key="test_p_bar") == "MPa"
......@@ -716,13 +721,13 @@ def test_IVData_08_multi_cols_uniqueness(datadir):
assert rep == {
"WithPadding_failing": {
("rail_tag & x_loc & block_label", "?"): [
"value " "{'RBL12 & " "3800.0 & " "s1'} is " "not " "unique"
"value {'RBL12 & 3800.0 & s1'} is not unique"
]
},
"asm_failing": {
("another", "?"): ["value {1.0} is not unique"],
("rail_tag & x_loc & block_label", "?"): [
"value {'RBL11 & " "3500 & RECARO1'} " "is not unique"
"value {'RBL11 & 3500.0 & RECARO1'} is not unique"
],
},
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment