似乎没有关于如何在单列操作上使用hy的文档,例如以下内容。如有任何帮助,将不胜感激:
# simple instantiation to scalar
df['a'] = '2'
# the above can be done like so: (-> df (.assign :a "2")) but would appreciate any better ways
# cast a column to int
df['a'] = df['a'].astype(int)
# creating derived columns
df['c'] = df['a'] + df['b']
#subsetting by columns
dd = df[['a','b']]
#subsetting by criteria
dd = df[(df['a'] > 1) & (df['b'] < 2)]
熊猫实际上并没有改变Python本身的语法或语义;它只使用操作符重载。因此,您可以使用相同运算符的Hy等价物而不会出现问题,尽管helper macros可以使pandas更加方便
相关问题 更多 >
编程相关推荐