帮助文档

前往官网
最新更新时间:2023-05-08 15:49:57

Python 原生类型方法

为了方便用户对 Python 原生类型的操作,Dataway 支持 Python 原生类型的常用方法:
数据类型方法方法类型功能输出类型
strendswith(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
bytescount(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
floatis_integer()方法是否整数bool
listcount(x)方法统计元素数量int
index(sub[, start[, end]])方法索引元素int
tuplecount(x)方法统计元素数量int
index(sub[, start[, end]])方法索引元素int
dictget(key[, default])方法获取 key 对应值any
items方法获取键值对列表list
setunion(*others)方法返回求并集后的新集合set
datetime.datetimetoday()类方法无时区当前时间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.datetoday()类方法当前日期datetime.date
strftime(format)方法格式化str
datetime.timestrftime(format)方法格式化str
DataSetid()方法获取数据集 IDint
partitions()方法获取数据集分区数int
schema()方法获取数据集 schemaSchema
Recorddata()方法以列表形式返回各项数据list
get(name, default=None)方法获取字段名对应数据any
schema()方法获取数据集 schemaSchema

 

内置常量和函数

表达式模式支持常量: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 第三方模块。

模块特性特性类型特性描述特性输出
timeasctime([t])函数struct_time 格式化str
ctime([secs])函数时间戳格式化str
gmtime([secs])函数生成 UTC 时区的struct_timestruct_time
localtime([secs])函数生成本地 struct_timestruct_time
mktime(t)函数struct_time 生成时间戳float
strftime(format[,t])函数struct_time 定制格式化str
strptime(string[,format])函数字符串构建 struct_timestruct_time
time()函数生成当前时间戳float
time_ns()函数生成当前时间戳(纳秒)int
mathe常量自然对数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
jsondumps(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
base64b64encode(s, altchars=None)函数base64 编码bytes
b64decode(s, altchars=None, validate=False)函数base64 解码bytes
randomrandint(a, b)函数[a,b]随机整数int
random()函数[0,1)随机浮点数float
urllibparse.quote(string, safe='/', encoding=None, errors=None)函数特殊字符转码str
parse.urlencode(query, doseq=False, safe='', encoding=None, errors=None)函数url 编码float
如果您在文档使用中遇到问题或者有改进建议,请点击 在线反馈