Skip to content

Instantly share code, notes, and snippets.

View brandon-b-miller's full-sized avatar

brandon-b-miller

  • NVIDIA
  • Chicago
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import cudf
if not (cudf.Scalar(2) > cudf.Scalar(3)):
# evaluates to “if not cudf.Scalar(False)”
print("It works!")
class A(object):
pass
a = A()
if a:
print("uh oh!")
import cudf
# an invalid op
x = cudf.Scalar('hello world!')
y = cudf.Scalar(42)
print(x + y)
import cudf
# a valid op
x = cudf.Scalar('2011-01-01', dtype='datetime64[ns]')
y = cudf.Scalar(100, dtype='timedelta64[ms]')
print(x + y)
import cudf
val = cudf.Scalar(12, dtype="int8")
print(val)
str_val = cudf.Scalar("hello", dtype="str")
print(str_val)
datetime_val = cudf.Scalar("2011-01-01", dtype="datetime64[ns]")
print(datetime_val)
import cudf
val = cudf.Scalar(1)
print(val)
import cudf
sr1 = cudf.Series([1,2,3])
sr2 = cudf.Series([2,3,4])
val = cudf.Scalar(1) # construct a cuDF scalar
result_1 = sr1 + val
result_2 = sr2 – val
sr1 = cudf.Series([1,2,3])
sr2 = cudf.Series([2,3,4])
val = 1
result_1 = sr1 + val
result_2 = sr2 – val