@@ -121,28 +121,30 @@ def test_csv(self):
121121 def test_dataframe (self ):
122122 # Boolean
123123 s_bool_ = pd .Series ([True , False ], dtype = np .bool_ )
124- s_bool8 = pd .Series ([True , False ], dtype = np .bool8 )
124+ s_bool8 = pd .Series ([True , False ], dtype = np .bool_ )
125125
126126 # Integers
127- s_byte = pd .Series ([100 , 999 ], dtype = np .byte )
127+ # Note starting with numpy 2.0, large positive throws error
128+ # instead of converting to negative
129+ s_byte = pd .Series ([100 , - 25 ], dtype = np .byte )
128130 s_short = pd .Series ([100 , 999 ], dtype = np .short )
129131 s_intc = pd .Series ([100 , 999 ], dtype = np .intc )
130132 s_int_ = pd .Series ([100 , 999 ], dtype = np .int_ )
131133 s_longlong = pd .Series ([100 , 999 ], dtype = np .longlong )
132134 s_intp = pd .Series ([100 , 999 ], dtype = np .intp )
133- s_int8 = pd .Series ([100 , 999 ], dtype = np .int8 )
135+ s_int8 = pd .Series ([100 , - 25 ], dtype = np .int8 )
134136 s_int16 = pd .Series ([100 , 999 ], dtype = np .int16 )
135137 s_int32 = pd .Series ([100 , 999 ], dtype = np .int32 )
136138 s_int64 = pd .Series ([100 , 999 ], dtype = np .int64 )
137139
138140 # Unsigned integers
139- s_ubyte = pd .Series ([100 , 999 ], dtype = np .ubyte )
141+ s_ubyte = pd .Series ([100 , 231 ], dtype = np .ubyte )
140142 s_ushort = pd .Series ([100 , 999 ], dtype = np .ushort )
141143 s_uintc = pd .Series ([100 , 999 ], dtype = np .uintc )
142- s_uint = pd .Series ([100 , 999 ], dtype = np .uint )
144+ s_uint = pd .Series ([100 , 231 ], dtype = np .uint )
143145 s_ulonglong = pd .Series ([100 , 999 ], dtype = np .ulonglong )
144146 s_uintp = pd .Series ([100 , 999 ], dtype = np .uintp )
145- s_uint8 = pd .Series ([100 , 999 ], dtype = np .uint8 )
147+ s_uint8 = pd .Series ([100 , 231 ], dtype = np .uint8 )
146148 s_uint16 = pd .Series ([100 , 999 ], dtype = np .uint16 )
147149 s_uint32 = pd .Series ([100 , 999 ], dtype = np .uint32 )
148150 s_uint64 = pd .Series ([100 , 999 ], dtype = np .uint64 )
@@ -151,7 +153,10 @@ def test_dataframe(self):
151153 s_half = pd .Series ([12.3 , 456.789 ], dtype = np .half )
152154 s_single = pd .Series ([12.3 , 456.789 ], dtype = np .single )
153155 s_double = pd .Series ([12.3 , 456.789 ], dtype = np .double )
154- s_longfloat = pd .Series ([12.3 , 456.789 ], dtype = np .longfloat )
156+ if hasattr (np , 'longfloat' ):
157+ s_longfloat = pd .Series ([12.3 , 456.789 ], dtype = np .longfloat )
158+ else :
159+ s_longfloat = pd .Series ([12.3 , 456.789 ], dtype = np .longdouble )
155160 s_float16 = pd .Series ([12.3 , 456.789 ], dtype = np .float16 )
156161 s_float32 = pd .Series ([12.3 , 456.789 ], dtype = np .float32 )
157162 s_float64 = pd .Series ([12.3 , 456.789 ], dtype = np .float64 )
@@ -172,7 +177,12 @@ def test_dataframe(self):
172177 # Python object
173178 s_object_ = pd .Series ([('tuple' , 'type' ), ('another' , 'tuple' )], dtype = np .object_ )
174179 s_str_ = pd .Series ([u'hello' , u'world' ], dtype = np .str_ ) # ASCII only
175- s_unicode_ = pd .Series ([u'hello' , u'\u2603 (snowman)' ], dtype = np .unicode_ )
180+ # AttributeError:
181+ # `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead.
182+ if hasattr (np , 'unicode_' ):
183+ s_unicode_ = pd .Series ([u'hello' , u'\u2603 (snowman)' ], dtype = np .unicode_ )
184+ else :
185+ s_unicode_ = pd .Series ([u'hello' , u'\u2603 (snowman)' ], dtype = np .str_ )
176186# s_void = pd.Series(..., dtype=np.void)
177187
178188 # Datetime
0 commit comments