擅长:python、mysql、java
<p>这提供了类似于R的<code>str()</code>的输出。它显示唯一值而不是初始值。</p>
<pre><code>def rstr(df): return df.shape, df.apply(lambda x: [x.unique()])
print(rstr(iris))
((150, 5), sepal_length [[5.1, 4.9, 4.7, 4.6, 5.0, 5.4, 4.4, 4.8, 4.3,...
sepal_width [[3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 2.9, 3.7,...
petal_length [[1.4, 1.3, 1.5, 1.7, 1.6, 1.1, 1.2, 1.0, 1.9,...
petal_width [[0.2, 0.4, 0.3, 0.1, 0.5, 0.6, 1.4, 1.5, 1.3,...
class [[Iris-setosa, Iris-versicolor, Iris-virginica]]
dtype: object)
</code></pre>