【问题标题】:Reading Excel File as an Array in Python via Pandas通过 Pandas 在 Python 中将 Excel 文件作为数组读取
【发布时间】:2021-07-14 17:48:20
【问题描述】:

所以基本上我想将工作表捕获为数组。

Excel 数据[][]: A / B / C // D / E / F // G / H / Z //

我想从代码返回 -----> data[0][0]=A , data[2][1]=F 等等。 你能帮我通过 python 中的 pandas 实现这一目标吗?

【问题讨论】:

标签: python pandas


【解决方案1】:

所以我用 numpy arrays 解决了这个问题,谢谢大家。

【讨论】:

  • 我先使用 Pandas 获取数据模板,然后将其转换为 numpy 数组。
  • 这是我实现这一目标的代码; -------> import pandas as pd data = pd.read_excel(r'location_of_excelfodler/excel_name.xlsx', sheet_name='Sheet_name') bdb=data.to_numpy() print(bdb[0][1])
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-06-08
  • 2017-03-02
  • 1970-01-01
  • 1970-01-01
  • 2019-01-27
  • 1970-01-01
相关资源
最近更新 更多