8

There are tons of Python/pandas/et al. questions on comparing IP addresses/ CIDR, but surprisingly almost no canonicals. Frankly it's one hell of a mess, and needs organization, cleanup.

  • some ask about native Python (2.x/3.x), some about pandas DataFrames (1 string or 4 integer columns), a few use the new Python 3.x package ipaddress or the older 2.x 'netaddr ip`, some about other libraries
  • some relate to single addresses, some to ranges
  • some use CIDR subnet mask notation /23, some involve wildcards '*'/'xxx' for subnets, some don't
  • almost all are about IPv4, few about IPv6 or -aware
  • almost all use decimal, not hex or octal
  • some use string comparison, some regex, some both, some a custom class (some user-defined, some standard-library)
  • some ask for programming simplicity, some optimal performance and scalability on large files/datasets
  • some use lists/sets, some regexes, some dataframes, some data structures like n-ary trees
  • (Also, making things further disorganized is the right tag should be , not , which relates to the actual protocol. Please help retag. And the CIDR examples are tagged if they're tagged at all, but almost never ).

To cover all these use cases, which questions should be canonical? (not necessarily from the following list, there might be missing need for a canonical, or we could reference a non-Python canonical):

  1. using regex Python: Efficient way to compare ip addresses in a csv file
  2. using a custom class Compare IP List to another IP List or IP Range
  3. comparing with a range Checking if IP address lies within a given range
  4. solutions for pandas and ipaddress Filter Pandas DataFrame by ip address range
  5. converting string to pandas DataFrame integer columns Error with split() when converting IP address to decimal using DataFrame
  6. Python regex to match IP-address with /CIDR
  7. Check if two CIDR addresses intersect?
  8. Convert and expand CIDR /8,/9 to /10
  9. a very old 2009 highly-upvoted question with 2.x answers, some obsolete How can I check if an ip is in a network in python 2.x
  10. Python - ip <-> subnet match? [duplicate]
  11. Check if user's IP address is in a range of IP's
  12. Pandas merge dataframes on ip-address by range
  13. "How can I sort out all the domain range from 192.55.22.0 to 192.56.22.0 through python"/"Enumerate all IP addresses in domain range..."
  14. ...and there are tons of others under keywords like 'subnet', 'domain', 'CIDR', 'host' and so on...
  15. ... please enumerate other candidate or missing canonicals
  16. ... we should also reference some algorithmic or C/Java/etc. canonicals
3
  • let's widen to "create python canonicals for a lot of common questions" like stackoverflow.com/questions/1207406/… and stackoverflow.com/questions/15112125/… and stackoverflow.com/questions/7208861/… ... Apr 24, 2018 at 9:34
  • @Jean-FrançoisFabre: please no, way too broad. I'm only trying to move one mountain, not the entire range. Seriously, this question is the quantum that I think is achievable. It's focused narrowly enough to keep the interest of the people interested in handling IP addresses. Don't ask them to start writing general language tutorials, that'll empty the room...
    – smci
    Apr 24, 2018 at 9:37
  • But by all means ask those questions of yours in a separate Meta thread, and cite it here.
    – smci
    Apr 24, 2018 at 9:38

0

You must log in to answer this question.

Browse other questions tagged .