remains of a comma operator? #2288
-
This is from an example in Mark Watsons book "A LIsp Programmer Living in Python-Land" (page 52). Variable all-data is a pandas DataFrame that has been read from a csv file.
I cannot get it working. The problem is the comma before "slice". The error message is "NameError: name 'hyx_XcommaX' is not defined". It looks like a comma operator, but has there ever been one in hy? I have seen some old discussion mentioning it. The problem is that I cannot figure out what the comma is doing there and how to change the code to make it do what it is supposed to do, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Python tuples were given their own dedicated syntax like all other datastructures instead of piggybacking off the comma expression syntax. i.e. All the following are equivalent (setv x-data10 (. all-data.iloc [#((slice 0 10) [0 1 2 3 4 5 6 7 8])] values))
(setv x-data10 (.values (get all-data.iloc #((slice 0 10) [0 1 2 3 4 5 6 7 8])))) there's also (setv x-data10 (.values (ncut all-data.iloc 0:10 [0 1 2 3 4 5 6 7 8]))) |
Beta Was this translation helpful? Give feedback.
Python tuples were given their own dedicated syntax like all other datastructures instead of piggybacking off the comma expression syntax. i.e.
#(1 2 3)
All the following are equivalent
there's also
ncut
from hyrule, which helps with this kind of multi-dimensional slicing