擅长:python、mysql、java
<p>正如@peter leimbigler所说,测向样品把你带到那里。你知道吗</p>
<pre><code>df.sample(10))
data
4 935000.0
13 850000.0
20 397000.0
7 980000.0
22 785578.0
18 957032.0
19 252000.0
10 600000.0
5 440000.0
0 770000.0
</code></pre>
<p>如果这些值存在于多个索引位置,则可能会重复某些值,但不应多次选择同一索引位置。你知道吗</p>
<p>如果只想对唯一值进行采样,可以使用df[column].unique,但不能直接对其进行采样。你知道吗</p>
<pre><code>unique_series = df["data"].unique()
df2 = pd.DataFrame(list(unique_series), columns=["data"])
data
0 770000.0
1 529400.0
2 780000.0
3 731300.0
4 935000.0
5 440000.0
6 634120.0
7 980000.0
8 600000.0
9 536613.0
10 660000.0
11 850000.0
12 563600.0
13 985000.0
14 957032.0
15 252000.0
16 397000.0
17 218750.0
18 785578.0
</code></pre>