python - pandas value_counts applied to each column -
I have a dataframe Many of them have no value at the CSV file, or they always have the same, in this way, I have to see
value_counts for each column quickly, how can I do this?
For example
id, temporary, name 1 34, blank, mark 2 22, blank, mark 3 34, blank, number - ID: & gt; 2, 22 - & gt; 1
- Temporary: Blank - & gt; 3
- Name: Symbol - & gt; 3
So I would know that the temp is irrelevant and the name is not interesting (always the same)
df = pd.DataFrame (data = [[34, 'null', 'mark'], [22, 'null', 'mark'], [34, 'blank / pre> The following code:
in df.column: print "----% s ---"% c print df [c] .value_counts () will generate the following results :
---- ID --- 34 2 22 1 dtype: int64 ---- temp --- null 3 dtype: int64 ---- name --- Icon 3 dtype: int64
Comments
Post a Comment