-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Weihua Li
committed
Sep 6, 2022
1 parent
485e3d3
commit a953be2
Showing
8 changed files
with
48 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pandas as pd | ||
import click | ||
import json | ||
|
||
@click.command() | ||
@click.argument('input_filename') | ||
@click.argument('output_filename') | ||
def process(input_filename, output_filename): | ||
df = read_csv(input_filename) | ||
filtered_data = filter_data(df) | ||
export(filtered_data, output_filename) | ||
|
||
def read_csv(input_filename): | ||
f = open(input_filename) | ||
data = json.load(f)['data']['requests'] | ||
df = pd.DataFrame(data) | ||
return df | ||
|
||
def filter_data(df): | ||
filtered_data = df[df['wtf'] == True] | ||
return filtered_data | ||
|
||
def export(filtered_data, output_filename): | ||
filtered_data.to_json(output_filename, orient='records') | ||
print("export filter graphics data") | ||
|
||
if __name__ == '__main__': | ||
process() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters