@@ -1135,9 +1135,9 @@ def __init__(self, data, x, y, **kwargs) -> None:
11351135 MPLPlot .__init__ (self , data , ** kwargs )
11361136 if x is None or y is None :
11371137 raise ValueError (self ._kind + " requires an x and y column" )
1138- if is_integer (x ) and not is_integer_dtype ( self .data .columns ) :
1138+ if is_integer (x ) and self .data .columns . _should_fallback_to_positional :
11391139 x = self .data .columns [x ]
1140- if is_integer (y ) and not is_integer_dtype ( self .data .columns ) :
1140+ if is_integer (y ) and self .data .columns . _should_fallback_to_positional :
11411141 y = self .data .columns [y ]
11421142
11431143 # Scatter plot allows to plot objects data
@@ -1194,7 +1194,7 @@ def __init__(self, data, x, y, s=None, c=None, **kwargs) -> None:
11941194 elif is_hashable (s ) and s in data .columns :
11951195 s = data [s ]
11961196 super ().__init__ (data , x , y , s = s , ** kwargs )
1197- if is_integer (c ) and not is_integer_dtype ( self .data .columns ) :
1197+ if is_integer (c ) and self .data .columns . _should_fallback_to_positional :
11981198 c = self .data .columns [c ]
11991199 self .c = c
12001200
@@ -1286,7 +1286,7 @@ def _kind(self) -> Literal["hexbin"]:
12861286
12871287 def __init__ (self , data , x , y , C = None , ** kwargs ) -> None :
12881288 super ().__init__ (data , x , y , ** kwargs )
1289- if is_integer (C ) and not is_integer_dtype ( self .data .columns ) :
1289+ if is_integer (C ) and self .data .columns . _should_fallback_to_positional :
12901290 C = self .data .columns [C ]
12911291 self .C = C
12921292
0 commit comments