cyberpandas — cyberpandas 0.1.0 documentation (original) (raw)
cyberpandas is a library for working with arrays of IP Addresses. It’s specifically designed to work well with pandas.
Key Concepts¶
IPType¶
This is a data type (like numpy.dtype('int64') orpandas.api.types.CategoricalDtype(). For the most part, you won’t interact with IPType directly. It will be the value of the .dtype attribute on your arrays.
IPArray¶
This is the container for your IPAddress data.
Usage¶
In [1]: from cyberpandas import IPArray
In [2]: import pandas as pd
In [3]: arr = IPArray(['192.168.1.1', ...: '2001:0db8:85a3:0000:0000:8a2e:0370:7334']) ...:
In [4]: arr Out[4]: IPArray(['192.168.1.1', '2001:db8:85a3::8a2e:370:7334'])
IPArray is a container for both IPv4 and IPv6 addresses. It can in turn be stored in pandas’ containers:
In [5]: pd.Series(arr) Out[5]: 0 192.168.1.1 1 2001:db8:85a3::8a2e:370:7334 dtype: ip
In [6]: pd.DataFrame({"addresses": arr}) Out[6]: addresses 0 192.168.1.1 1 2001:db8:85a3::8a2e:370:7334
See Usage for more.
API¶
Contents: