3434
3535## JSON encoding
3636numeric_list = [1 , 2 , 3 ]
37- np_list = np .array ([1 , 2 , 3 , np .NaN , np .NAN , np . Inf , dt (2014 , 1 , 5 )])
37+ np_list = np .array ([1 , 2 , 3 , np .nan , np .inf , dt (2014 , 1 , 5 )])
3838mixed_list = [
3939 1 ,
4040 "A" ,
4545dt_list = [dt (2014 , 1 , 5 ), dt (2014 , 1 , 5 , 1 , 1 , 1 ), dt (2014 , 1 , 5 , 1 , 1 , 1 , 1 )]
4646
4747df = pd .DataFrame (
48- columns = ["col 1" ], data = [1 , 2 , 3 , dt (2014 , 1 , 5 ), pd .NaT , np .NaN , np .Inf ]
48+ columns = ["col 1" ], data = [1 , 2 , 3 , dt (2014 , 1 , 5 ), pd .NaT , np .nan , np .inf ]
4949)
5050
5151rng = pd .date_range ("1/1/2011" , periods = 2 , freq = "H" )
@@ -184,7 +184,7 @@ def test_figure_json_encoding(self):
184184
185185 assert (
186186 js1 == '{"type": "scatter3d", "x": [1, 2, 3], '
187- '"y": [1, 2, 3, null, null, null, "2014-01-05T00:00:00"], '
187+ '"y": [1, 2, 3, null, null, "2014-01-05T00:00:00"], '
188188 '"z": [1, "A", "2014-01-05T00:00:00", '
189189 '"2014-01-05T01:01:01", "2014-01-05T01:01:01.000001"]}'
190190 )
@@ -195,9 +195,9 @@ def test_figure_json_encoding(self):
195195 _json .dumps (figure , cls = utils .PlotlyJSONEncoder , sort_keys = True )
196196
197197 # Test data wasn't mutated
198- np_array = np .array ([1 , 2 , 3 , np .NaN , np .NAN , np . Inf , dt (2014 , 1 , 5 )])
198+ np_array = np .array ([1 , 2 , 3 , np .nan , np .inf , dt (2014 , 1 , 5 )])
199199 for k in range (len (np_array )):
200- if k in [ 3 , 4 ] :
200+ if k == 3 :
201201 # check NaN
202202 assert np .isnan (np_list [k ]) and np .isnan (np_array [k ])
203203 else :
@@ -237,7 +237,7 @@ def test_pandas_json_encoding(self):
237237 # Test that data wasn't mutated
238238 assert_series_equal (
239239 df ["col 1" ],
240- pd .Series ([1 , 2 , 3 , dt (2014 , 1 , 5 ), pd .NaT , np .NaN , np .Inf ], name = "col 1" ),
240+ pd .Series ([1 , 2 , 3 , dt (2014 , 1 , 5 ), pd .NaT , np .nan , np .inf ], name = "col 1" ),
241241 )
242242
243243 j2 = _json .dumps (df .index , cls = utils .PlotlyJSONEncoder )
0 commit comments