有奖捉虫:行业应用 & 管理与支持文档专题 HOT

Python 原生类型方法

为了方便用户对 Python 原生类型的操作,Dataway 支持 Python 原生类型的常用方法:
数据类型
方法
方法类型
功能
输出类型
str
endswith(suffix[, start[, end]])
方法
后缀对比
bool
split(sep=None, maxsplit=-1)
方法
分割
list
startswith(prefix[, start[, end]])
方法
前缀对比
bool
count(sub[, start[, end]])
方法
统计子串数量
int
find(sub[, start[, end]])
方法
查找匹配子串
int
format(*args, **kwargs)
方法
格式化
str
index(sub[, start[, end]])
方法
索引匹配子串
int
isascii()
方法
返回全是 ASCII 字符
bool
isspace()
方法
返回是否非空且全是空白字符
bool
encode(encoding="utf-8", errors="strict")
方法
编码
bytes
join(iterable)
方法
拼接
str
lower()
方法
小写
str
replace(old, new[, count])
方法
替换
str
strip([chars])
方法
移除特定字符组成的前后缀
str
upper()
方法
大写
str
bytes
count(sub[, start[, end]])
方法
统计子串数量
int
find(sub[, start[, end]])
方法
查找匹配子串
int
index(sub[, start[, end]])
方法
索引匹配子串
int
decode(encoding="utf-8", errors="strict")
方法
解码
str
replace(old, new[, count])
方法
替换
bytes
rstrip([chars])
方法
移除特定字符集合组成的后缀
bytes
strip([chars])
方法
移除特定字符集合组成的前后缀
bytes
split(sep=None, maxsplit=-1)
方法
分割
list
startswith(prefix[, start[, end]])
方法
前缀对比
bool
endswith(prefix[, start[, end]])
方法
后缀对比
bool
float
is_integer()
方法
是否整数
bool
list
count(x)
方法
统计元素数量
int
index(sub[, start[, end]])
方法
索引元素
int
tuple
count(x)
方法
统计元素数量
int
index(sub[, start[, end]])
方法
索引元素
int
dict
get(key[, default])
方法
获取 key 对应值
any
items
方法
获取键值对列表
list
set
union(*others)
方法
返回求并集后的新集合
set
datetime.datetime
today()
类方法
无时区当前时间
datetime.datetime
fromtimestamp(timestamp, tz=None)
类方法
从时间戳构造时间
datetime.datetime
now()
类方法
带时区当前时间
datetime.datetime
strptime(date_string, format)
类方法
从格式化构造时间
datetime.datetime
time()
方法
转换为时钟
datetime.time
date()
方法
转换为日期
datetime.date
strftime(format)
方法
格式化
str
datetime.date
today()
类方法
当前日期
datetime.date
strftime(format)
方法
格式化
str
datetime.time
strftime(format)
方法
格式化
str
DataSet
id()
方法
获取数据集 ID
int
partitions()
方法
获取数据集分区数
int
schema()
方法
获取数据集 schema
Schema
Record
data()
方法
以列表形式返回各项数据
list
get(name, default=None)
方法
获取字段名对应数据
any
schema()
方法
获取数据集 schema
Schema

内置常量和函数

表达式模式支持常量:None、True 和 False。除此之外,为了方便用户使用,表达式模式内置了许多函数,用户可以调用相关函数,快速实现对应的功能,获取所需数据。
内置函数
函数说明
abs(x)
返回绝对值(整数、浮点数)
all(iterable)
返回是否所有元素为真或为空
any(iterable)
返回是否存在元素为真
ascii(object)
打印 object 但不处理非 ASCII 字母
bool([x])
转换为 bool
bytes([source[,encoding[,errors]]])
转换为 bytes
chr(i)
返回 int 对应的 unicode
dict(kwarg)/dict(mapping,kwarg)/dict(iterable,kwarg)
转换为 dict
float([x])
转换为 float
int(x)/int(x,base)
转换为 int
len(s)
返回长度
list([iterable])
转换为 list
max(iterable,[,key,default])/max(arg1,arg2,args[,key])
返回最大值
min(iterable,[,key,default])/min(arg1,arg2,args[,key])
返回最小值
ord(c)
返回 char 对应编码
pow(x,y[,z])
返回指数
range(stop)/(start,stop[,step])
返回不可改列表
repr(object)
返回可打印对象信息
round(number[,ndigits])
四舍五入偏偶数
set([iterable])
转换为集合
str(object)/(object,encoding,errors)
转换为 str
sum(iterable[,start])
求和
tuple([iterable])
转换为 tuple
type(object)
返回数据类型

其他第三方模块

表达式模式支持部分常见 Python 第三方模块。
模块
特性
特性类型
特性描述
特性输出
time
asctime([t])
函数
struct_time 格式化
str
ctime([secs])
函数
时间戳格式化
str
gmtime([secs])
函数
生成 UTC 时区的struct_time
struct_time
localtime([secs])
函数
生成本地 struct_time
struct_time
mktime(t)
函数
struct_time 生成时间戳
float
strftime(format[,t])
函数
struct_time 定制格式化
str
strptime(string[,format])
函数
字符串构建 struct_time
struct_time
time()
函数
生成当前时间戳
float
time_ns()
函数
生成当前时间戳(纳秒)
int
math
e
常量
自然对数
float
pi
常量
圆周率
float
sqrt(x)
函数
开方
float
log(x[,base])
函数
对数
float
ceil(x)
函数
向上取整
int
floor(x)
函数
向下取整
int
cos(x)
函数
余弦
float
fabs(x)
函数
绝对值
float
log2(x)
函数
以2为底对数
float
log10(x)
函数
以10为底对数
float
pow(x,y)
函数
指数
float
sin(x)
函数
正弦
float
tan(x)
函数
正切
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)
函数
json 编码
str
loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)
函数
json 解码
any
base64
b64encode(s, altchars=None)
函数
base64 编码
bytes
b64decode(s, altchars=None, validate=False)
函数
base64 解码
bytes
random
randint(a, b)
函数
[a,b]随机整数
int
random()
函数
[0,1)随机浮点数
float
urllib
parse.quote(string, safe='/', encoding=None, errors=None)
函数
特殊字符转码
str
parse.urlencode(query, doseq=False, safe='', encoding=None, errors=None)
函数
url 编码
float