Headers: Volume Energy Enthalpy
Subheaders: vf vg uf ug hf hfg hg
例如:如果我想选择[焓,hfg],我会期望如下:
df = pd.read_html('url', header=[2,1])
I used this post as a reference,但这不起作用
import pandas as pd
def get_data_from_webpage(url):# This returns a list of dataframes
t_table = pd.read_html(url, header=1)
return t_table[0]
result = get_data_from_webpage('http://ouopentextbooks.org/thermodynamics/saturation-properties-temperature-table/') # Url with table being passed through function.
print(result)
从这里,我想选择temp列作为键,然后将相应行的其余部分放入查找表中。然后,当用户输入键时,它输出相应的值行
最终结果如下:
用户输入:20
输出:vf、uf、hf和sf值
好的,我做了一个解决方案。但是,您可能必须首先执行
pip install Unidecode
来安装必要的库我使用字母表作为索引,以避免混淆用户,因为列是数字的
以下是输出:
代码如下:
相关问题 更多 >
编程相关推荐