Skip to content

Commit 2633bf9

Browse files
code sample for pandas-dev#46406
1 parent 9c99d90 commit 2633bf9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bisect/46406.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# BUG: iloc not possible for sparse DataFrame #46406
2+
3+
import pandas as pd
4+
5+
print(pd.__version__)
6+
7+
df = pd.DataFrame([[1.0, 0.0, 1.5], [0.0, 2.0, 0.0]], dtype=pd.SparseDtype(float))
8+
result = df.iloc[0]
9+
print(result)
10+
11+
expected = pd.Series([1.0, 0.0, 1.5], dtype=pd.SparseDtype(float), name=0)
12+
pd.testing.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)