@@ -363,6 +363,39 @@ def is_monotonic_decreasing(self):
363363 window = Window .orderBy (monotonically_increasing_id ()).rowsBetween (- 1 , - 1 )
364364 return self ._with_new_scol ((col <= F .lag (col , 1 ).over (window )) & col .isNotNull ()).all ()
365365
366+ @property
367+ def ndim (self ):
368+ """
369+ Return an int representing the number of array dimensions.
370+
371+ Return 1 for Series / Index / MultiIndex.
372+
373+ Examples
374+ --------
375+
376+ For Series
377+
378+ >>> s = ks.Series([None, 1, 2, 3, 4], index=[4, 5, 2, 1, 8])
379+ >>> s.ndim
380+ 1
381+
382+ For Index
383+
384+ >>> s.index.ndim
385+ 1
386+
387+ For MultiIndex
388+
389+ >>> midx = pd.MultiIndex([['lama', 'cow', 'falcon'],
390+ ... ['speed', 'weight', 'length']],
391+ ... [[0, 0, 0, 1, 1, 1, 2, 2, 2],
392+ ... [1, 1, 1, 1, 1, 2, 1, 2, 2]])
393+ >>> s = ks.Series([45, 200, 1.2, 30, 250, 1.5, 320, 1, 0.3], index=midx)
394+ >>> s.index.ndim
395+ 1
396+ """
397+ return 1
398+
366399 def astype (self , dtype ):
367400 """
368401 Cast a Koalas object to a specified dtype ``dtype``.
0 commit comments