1515
1616@pytest .mark .parametrize (
1717 "method" ,
18- [lambda ser : ser .values , lambda ser : np .asarray (ser )],
19- ids = ["values" , "asarray" ],
18+ [
19+ lambda ser : ser .values ,
20+ lambda ser : np .asarray (ser ),
21+ lambda ser : np .array (ser , copy = False ),
22+ ],
23+ ids = ["values" , "asarray" , "array" ],
2024)
2125def test_series_values (method ):
2226 ser = Series ([1 , 2 , 3 ], name = "name" )
@@ -40,8 +44,12 @@ def test_series_values(method):
4044
4145@pytest .mark .parametrize (
4246 "method" ,
43- [lambda df : df .values , lambda df : np .asarray (df )],
44- ids = ["values" , "asarray" ],
47+ [
48+ lambda df : df .values ,
49+ lambda df : np .asarray (df ),
50+ lambda ser : np .array (ser , copy = False ),
51+ ],
52+ ids = ["values" , "asarray" , "array" ],
4553)
4654def test_dataframe_values (method ):
4755 df = DataFrame ({"a" : [1 , 2 , 3 ], "b" : [4 , 5 , 6 ]})
@@ -82,7 +90,7 @@ def test_series_to_numpy():
8290 ser .iloc [0 ] = 0
8391 assert ser .values [0 ] == 0
8492
85- # specify copy=False gives a writeable array
93+ # specify copy=True gives a writeable array
8694 ser = Series ([1 , 2 , 3 ], name = "name" )
8795 arr = ser .to_numpy (copy = True )
8896 assert not np .shares_memory (arr , get_array (ser , "name" ))
0 commit comments