To help you manipulate native types in Python, Dataway supports the following common Python methods:
Data Type | Method | Method Type | Feature | Output Type |
---|---|---|---|---|
str | endswith(suffix[, start[, end]]) | Method | Compares suffixes. | bool |
split(sep=None, maxsplit=-1) | Method | Splits data. | list | |
startswith(prefix[, start[, end]]) | Method | Compares the prefixes. | bool | |
count(sub[, start[, end]]) | Method | Counts substrings. | int | |
find(sub[, start[, end]]) | Method | Searches for matched substrings. | int | |
format(*args, **kwargs) | Method | Formatting. | str | |
index(sub[, start[, end]]) | Method | Indexes matched substrings. | int | |
isascii() | Method | Returns whether the data has only ASCII characters. | bool | |
isspace() | Method | Returns whether the data is non-empty and has only whitespace characters. | bool | |
encode(encoding="utf-8", errors="strict") | Method | Encodes the data. | bytes | |
join(iterable) | Method | Concatenation. | str | |
lower() | Method | Converts the data into lowercase letters. | str | |
replace(old, new[, count]) | Method | Replaces data. | str | |
strip([chars]) | Method | Removes the prefix and suffix consisting of the specified characters. | str | |
upper() | Method | Converts the data into uppercase letters. | str | |
bytes | count(sub[, start[, end]]) | Method | Counts substrings. | int |
find(sub[, start[, end]]) | Method | Searches for matched substrings. | int | |
index(sub[, start[, end]]) | Method | Indexes matched substrings. | int | |
decode(encoding="utf-8", errors="strict") | Method | Decodes the data. | str | |
replace(old, new[, count]) | Method | Replaces the data. | bytes | |
rstrip([chars]) | Method | Removes the suffix consisting of the specified characters. | bytes | |
strip([chars]) | Method | Removes the prefix and suffix consisting of the specified characters. | bytes | |
split(sep=None, maxsplit=-1) | Method | Splits data. | list | |
startswith(prefix[, start[, end]]) | Method | Compares the prefixes. | bool | |
endswith(prefix[, start[, end]]) | Method | Compares the suffixes. | bool | |
float | is_integer() | Method | Returns whether the data is an integer. | bool |
list | count(x) | Method | Counts elements. | int |
index(sub[, start[, end]]) | Method | Indexes elements. | int | |
tuple | count(x) | Method | Counts elements. | int |
index(sub[, start[, end]]) | Method | Indexes elements. | int | |
dict | get(key[, default]) | Method | Gets the `key` value. | any |
items | Method | Gets the key-value pair list. | list | |
set | union(*others) | Method | Returns the new set, which is a union of the specified sets. | set |
datetime.datetime | today() | Class method | Gets the current time without a time zone. | datetime.datetime |
fromtimestamp(timestamp, tz=None) | Class method | Constructs the time based on a timestamp. | datetime.datetime | |
now() | Class method | Gets the current time with a time zone. | datetime.datetime | |
strptime(date_string, format) | Class method | Constructs the formatted time. | datetime.datetime | |
time() | Method | Converts the data into a time point. | datetime.time | |
date() | Method | Converts the data into a date. | datetime.date | |
strftime(format) | Method | Formatting. | str | |
datetime.date | today() | Class method | Gets the current date. | datetime.date |
strftime(format) | Method | Formatting. | str | |
datetime.time | strftime(format) | Method | Formatting. | str |
DataSet | id() | Method | Gets the data set ID. | int |
partitions() | Method | Gets the number of data set partitions. | int | |
schema() | Method | Gets the data set schema. | Schema | |
Record | data() | Method | Returns the elements as a list. | list |
get(name, default=None) | Method | Gets the data of the specified field name. | any | |
schema() | Method | Gets the data set schema. | Schema |
The expression mode supports constants None
, True
, and False
. In addition, for ease of use, the expression mode has many built-in functions, which you can call to quickly implement the corresponding features and get the required data.
Built-in Function | Description |
---|---|
abs(x) | Returns the absolute value of an integer or floating-point number. |
all(iterable) | Returns whether all elements are True or None . |
any(iterable) | Returns whether any elements are True . |
ascii(object) | Prints the object without processing non-ASCII characters. |
bool([x]) | Converts the data into a boolean value. |
bytes([source[,encoding[,errors]]]) | Converts the data into a bytes object. |
chr(i) | Returns the Unicode of an integer. |
dict(kwarg)/dict(mapping,kwarg)/dict(iterable,kwarg) | Converts the data into a dict object. |
float([x]) | Converts the data into a float. |
int(x)/int(x,base) | Converts the data into an integer. |
len(s) | Returns the length. |
list([iterable]) | Converts the data into a list. |
max(iterable,[,key,default])/max(arg1,arg2,args[,key]) | Returns the maximum value. |
min(iterable,[,key,default])/min(arg1,arg2,args[,key]) | Returns the minimum value. |
ord(c) | Returns the code of a char object. |
pow(x,y[,z]) | Returns the value of x to the power of y , modulus z . |
range(stop)/(start,stop[,step]) | Returns an immutable list. |
repr(object) | Returns the information of the specified printable object. |
round(number[,ndigits]) | Returns the number rounded to ndigits precision after the decimal point. |
set([iterable]) | Converts the data into a set. |
str(object)/(object,encoding,errors) | Converts the data into a string. |
sum(iterable[,start]) | Calculates the sum. |
tuple([iterable]) | Converts the data into a tuple. |
type(object) | Returns the data type. |
The expression mode supports some common third-party Python modules.
Module | Feature | Feature Type | Description | Feature Output |
---|---|---|---|---|
time | asctime([t]) | Function | Formats `struct_time`. | str |
ctime([secs]) | Function | Formats a timestamp. | str | |
gmtime([secs]) | Function | Generates the `struct_time` with a UTC time zone. | struct_time | |
localtime([secs]) | Function | Generates the local `struct_time`. | struct_time | |
mktime(t) | Function | Generates a timestamp for `struct_time`. | float | |
strftime(format[,t]) | Function | Converts `struct_time` into a custom format. | str | |
strptime(string[,format]) | Function | Converts `struct_time` into a string. | struct_time | |
time() | Function | Generates the current timestamp. | float | |
time_ns() | Function | Generates the current timestamp in nanoseconds. | int | |
math | e | Constant | Value of Euler's number. | float |
pi | Constant | Value of Pi. | float | |
sqrt(x) | Function | Returns the square root. | float | |
log([x,base]) | Function | Returns the logarithm. | float | |
ceil(x) | Function | Returns the smallest integer greater than or equal to `x`. | int | |
floor(x) | Function | Returns the greatest integer less than or equal to `x`. | int | |
cos(x) | Function | Returns the cosine. | float | |
fabs(x) | Function | Returns the absolute value. | float | |
log2(x) | Function | Returns the base-2 logarithm of `x`. | float | |
log10(x) | Function | Returns the base-10 logarithm of `x`. | float | |
pow(x,y) | Function | Returns the value of `x` raised to the power `y`. | float | |
sin(x) | Function | Returns the sine. | float | |
tan(x) | Function | Returns the tangent. | float | |
json | dumps(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw) | Function | Encodes the data into JSON format. | str |
loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) | Function | Decodes the JSON data. | any | |
base64 | b64encode(s, altchars=None) | Function | Encodes the data into Base64 format. | bytes |
b64decode(s, altchars=None, validate=False) | Function | Decodes the Base64 data. | bytes | |
random | randint(a, b) | Function | Returns a random integer in the range of [a,b]. | int |
random() | Function | Returns a random floating-point number in the range of [0,1). | float | |
urllib | parse.quote(string, safe='/', encoding=None, errors=None) | Function | Transcodes symbols. | str |
parse.urlencode(query, doseq=False, safe='', encoding=None, errors=None) | Function | Encodes the URL. | float |
Was this page helpful?