April 15, 2025
如果您有关注过去一年中 Python DataFrame 的进展,那么您一定听说过 Polars,专为处理大型数据集而设计的强大 DataFrame 库。

与 Spark、Dask 和 Ray 等处理大型数据集的其他库有所不同,Polars 在单台机器上使用,也因此引起许多与 pandas 的比较。 事实上,Polars 在许多重要方面都与 pandas 存在差异,包括数据处理方式以及最佳应用。 下文将探讨这两种 DataFrame 库的技术细节区别,并分析其各自优点和局限。
如果您想听 Polars 的缔造者 Ritchie Vink 亲口讲述,您可以在此处找到我们对他的采访!
为什么使用 Polars 而不是 pandas?
#
两个字:性能。 Polars 从一开始就速度极快,执行常见运算的速度是 pandas 的 5 到 10 倍。 另外,Polars 运算的内存需求明显小于 pandas:pandas 需要数据集大小的 5 到 10 倍左右的 RAM 来执行运算,而 Polars 需要 2 到 4 倍。
您可以在这里了解 Polars 与其他 DataFrame 库的性能对比。 对于常见运算,Polars 的速度是 pandas 的 10 到 100 倍,也是最快的 DataFrame 库之一。 此外,在内存不足错误之前,它可以处理比 pandas 更大的数据集。
...
November 10, 2023
想要找到3位长度的github ID,可以对用户页URL进行探测,找到所有不可用的就有可能没有注册。
使用python很简单能实现以上需求。
首先安装pip requests
import requests
for x1 in range(97,123):
for x2 in range(97,123):
for x3 in range(97,123):
url='https://github.com/'+chr(x1)+chr(x2)+chr(x3)
r=requests.get(url)
print(url,r.status_code)
其中range(97,123)就是遍历a-z
运行结果如下:
root@bwg:~# python3 ./gid.py
https://github.com/aaa status 200
https://github.com/aab status 200
https://github.com/aac status 200
https://github.com/aad status 200
https://github.com/aae status 200
https://github.com/aaf status 200
https://github.com/aag status 200
https://github.com/aah status 200
... ...