0

i got a code from a colleague. in one of the lines i found a for-loop with a rarely configuration, see below. Can you explain me why "i" stays in front of the for-loop?

ix = [i for i in range(data.shape[1]) if i != 23]
  • This structure is called a *list comprehension* and the `i` at the beginning is the value that will be in the created list. – khelwood Mar 04 '21 at 16:01
  • 1
    Does this answer your question? [What does "list comprehension" mean? How does it work and how can I use it?](https://stackoverflow.com/questions/34835951/what-does-list-comprehension-mean-how-does-it-work-and-how-can-i-use-it) – khelwood Mar 04 '21 at 16:02

0 Answers0