2016-12-18

Python - Traversing lists or data frames (xrange vs in)

# Method 1
# Requires knowing the length of the object to iterate over (n)
for i in xrange( 0, n ): action_code_here
# Method 2
# Does not require preemptively knowing the size of the traversed object
for i in list_or_dataFrame: action_code_here

No comments:

Post a Comment