Python numpy.ma.flatnotmasked_contiguous()函数
numpy.ma.flatnotmasked_contiguous()函数沿着给定的轴在屏蔽数组中找到连续的未屏蔽的数据。
语法: numpy.ma.flatnotmasked_contiguous(arr)
参数 :
arr : [ array_like] 输入数组。
返回 : [slice_list ] 一个排序的切片对象序列(起始索引,结束索引)。
代码#1:
# Python program explaining
# numpy.ma.flatnotmasked_contiguous() function
# importing numpy as geek
# and numpy.ma module as ma
import numpy as geek
import numpy.ma as ma
arr = geek.ma.arange(8)
gfg = geek.ma.flatnotmasked_contiguous(arr)
print (gfg)
输出 :
slice(0, 8, None)
代码#2:
# Python program explaining
# numpy.ma.flatnotmasked_contiguous() function
# importing numpy as geek
# and numpy.ma module as ma
import numpy as geek
import numpy.ma as ma
arr = geek.ma.arange(12)
gfg = geek.ma.flatnotmasked_contiguous(arr)
print (gfg)
输出 :
slice(0, 12, None)