Skip to main content

快速将Excel复制的表格文本转换为NumPy数组

Project description

numpytable

每次复制Excel表格的数据到Python中,都要手动添加括号和逗号,非常繁琐。

目的:快速将Excel等工具复制的表格文本转换为NumPy数组,告别手动添加括号和逗号的繁琐操作。

安装

pip install numpytable

用法

  1. 在Excel(或其他表格工具)中选中数据并复制(元素间默认用制表符分隔):

    2.2681	6.623	2.6459
    2.3407	6.574	2.1304
    2.8451	6.4258	2.1178
    
  2. 在Python中用from_table函数转换:

    import numpy as np
    from numpytable import from_table
    
    # 直接粘贴复制的文本,用三引号包裹
    data = np.array(from_table("""
    2.2681	6.623	2.6459
    2.3407	6.574	2.1304
    2.8451	6.4258	2.1178
    """))
    
    print(data)
    # 输出:
    # [[2.2681 6.623  2.6459]
    #  [2.3407 6.574  2.1304]
    #  [2.8451 6.4258 2.1178]]
    

特性

  • 自动处理换行和制表符,无需手动格式化
  • 支持整数、浮点数自动识别
  • 检测并警告行数不一致的情况
  • 轻量依赖(仅需numpy)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numpytable-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numpytable-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file numpytable-0.1.0.tar.gz.

File metadata

  • Download URL: numpytable-0.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.2

File hashes

Hashes for numpytable-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac915ea4d3a41757ab8d0dcbcc2944bef5460539d4272f0b173a924780cde567
MD5 948426e15541ef5ffec6ecc2939fc23a
BLAKE2b-256 25e10a76f62ea1ddd48f6788d4375e7e17903d4f37dcaa992da0107c382b49d5

See more details on using hashes here.

File details

Details for the file numpytable-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: numpytable-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.2

File hashes

Hashes for numpytable-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 760cf6175066d459d4c86b3aa2f65ecb28c26ce3443bd4e3359eb0660882c9c8
MD5 fe85d2382e16ade33cc1be412772ccd8
BLAKE2b-256 02eb99d9bff7ea7a46a72c8c996273a1f290736c3b6e8064f0b4841a70d26c7b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page