Skip to content

Commit

Permalink
improving agg step
Browse files Browse the repository at this point in the history
  • Loading branch information
liliblu committed Sep 18, 2019
1 parent 690ab13 commit f03a7d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
12 changes: 5 additions & 7 deletions blacksheep/_outlierTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,12 @@ def _convert_to_counts(
outlier_cols = [x + col_seps + col_outlier_suffix for x in samples]

if aggregate:
df[agg_col] = [ind.split(ind_sep)[0] for ind in df.index]
df.index = [ind.split(ind_sep)[0] for ind in df.index]
df_inv = df == 0

output_df = pd.DataFrame()
output_df[not_outlier_cols] = df.groupby(by=agg_col)[samples].agg(
lambda x: pd.Series(x == 0).sum()
)
output_df[outlier_cols] = df.groupby(by=agg_col)[samples].agg(
lambda x: pd.Series(x == 1).sum()
)
output_df[not_outlier_cols] = df_inv.groupby(level=0)[samples].sum()
output_df[outlier_cols] = df.groupby(level=0)[samples].sum()
elif not aggregate:
output_df = pd.DataFrame(index=df.index)
output_df[outlier_cols] = df[samples]
Expand Down
8 changes: 0 additions & 8 deletions blksheep/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,12 @@ build:

requirements:
host:
- matplotlib >=3.1.0
- numpy >=1.16.4
- pandas >=0.24.2
- pip
- python >=3.6
- scikit-learn >=0.21.2
- scipy >=1.2.1
- seaborn >=0.9.0
- statsmodels >=0.10.0
run:
- matplotlib >=3.1.0
- numpy >=1.16.4
- pandas >=0.24.2
- python
- scikit-learn >=0.21.2
- scipy >=1.2.1
- seaborn >=0.9.0
Expand Down

0 comments on commit f03a7d5

Please sign in to comment.