jzhan-2026 commented on code in PR #60577:
URL: https://github.com/apache/spark/pull/60577#discussion_r4623417898


##########
python/pyspark/pandas/frame.py:
##########
@@ -3890,13 +3890,20 @@ def between_time(
                              A
         2018-04-09 00:00:00  1
         2018-04-12 01:00:00  4
+
+        Use ``axis=1`` to select columns whose labels fall between the two 
times:
+
+        >>> psdf = ps.DataFrame([[1, 2, 3, 4]], columns=idx)
+        >>> psdf.between_time('0:15', '0:45', axis=1)
+           2018-04-10 00:20:00  2018-04-11 00:40:00
+        0                    2                    3
         """
         axis = validate_axis(axis)
 
-        if axis != 0:
-            raise NotImplementedError("between_time currently only works for 
axis=0")
-
-        if not isinstance(self.index, ps.DatetimeIndex):
+        if axis == 1:
+            if not isinstance(self.columns, pd.DatetimeIndex):
+                raise TypeError("Index must be DatetimeIndex")

Review Comment:
   Thanks for the review, @holdenk! I want to make sure I understand this one. 
Are you asking whether the `elif` check should use the labels for the selected 
axis, instead of hard-coding `self.index`? If so, I'll update it to match the 
`axis == 1` branch. If you meant something else, could you say a bit more? 
Thanks!
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to