Improved value counts
Project description
countvalues
Install
pip install countvalues
How to use
import pandas as pd
from countvalues.core import count_values
df = pd.read_csv('../data/titanic.csv')
df.head()
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
PassengerId | Survived | Pclass | Name | Sex | Age | SibSp | Parch | Ticket | Fare | Cabin | Embarked | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 0 | 3 | Braund, Mr. Owen Harris | male | 22.0 | 1 | 0 | A/5 21171 | 7.2500 | NaN | S |
1 | 2 | 1 | 1 | Cumings, Mrs. John Bradley (Florence Briggs Th... | female | 38.0 | 1 | 0 | PC 17599 | 71.2833 | C85 | C |
2 | 3 | 1 | 3 | Heikkinen, Miss. Laina | female | 26.0 | 0 | 0 | STON/O2. 3101282 | 7.9250 | NaN | S |
3 | 4 | 1 | 1 | Futrelle, Mrs. Jacques Heath (Lily May Peel) | female | 35.0 | 1 | 0 | 113803 | 53.1000 | C123 | S |
4 | 5 | 0 | 3 | Allen, Mr. William Henry | male | 35.0 | 0 | 0 | 373450 | 8.0500 | NaN | S |
count_values(df, 'Sex')
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
Sex | count | percentual | cumulative_percentual | |
---|---|---|---|---|
0 | female | 314 | 0.352413 | 0.352413 |
1 | male | 577 | 0.647587 | 1.000000 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
countvalues-0.0.1.tar.gz
(8.3 kB
view hashes)
Built Distribution
Close
Hashes for countvalues-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 253577dadb04f3ac17748fb00a7210fef0a87b7a1337edaca6f7de423d01d2a2 |
|
MD5 | 396f32fc93c94b6380bc7824ef9f045f |
|
BLAKE2b-256 | d5e067063a274bf0f03ebef062df8d7a89ad7e83b6812fede8c1fabbe16d730e |