mirror of
https://github.com/Azure/MachineLearningNotebooks.git
synced 2025-12-20 01:27:06 -05:00
Compare commits
1 Commits
azureml-sd
...
release_up
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
879607e59b |
@@ -5,17 +5,6 @@ import argparse
|
|||||||
import os
|
import os
|
||||||
from azureml.core import Run
|
from azureml.core import Run
|
||||||
|
|
||||||
|
|
||||||
def get_dict(dict_str):
|
|
||||||
pairs = dict_str.strip("{}").split(r'\;')
|
|
||||||
new_dict = {}
|
|
||||||
for pair in pairs:
|
|
||||||
key, value = pair.strip().split(":")
|
|
||||||
new_dict[key.strip().strip("'")] = value.strip().strip("'")
|
|
||||||
|
|
||||||
return new_dict
|
|
||||||
|
|
||||||
|
|
||||||
print("Cleans the input data")
|
print("Cleans the input data")
|
||||||
|
|
||||||
# Get the input green_taxi_data. To learn more about how to access dataset in your script, please
|
# Get the input green_taxi_data. To learn more about how to access dataset in your script, please
|
||||||
@@ -23,7 +12,6 @@ print("Cleans the input data")
|
|||||||
run = Run.get_context()
|
run = Run.get_context()
|
||||||
raw_data = run.input_datasets["raw_data"]
|
raw_data = run.input_datasets["raw_data"]
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser("cleanse")
|
parser = argparse.ArgumentParser("cleanse")
|
||||||
parser.add_argument("--output_cleanse", type=str, help="cleaned taxi data directory")
|
parser.add_argument("--output_cleanse", type=str, help="cleaned taxi data directory")
|
||||||
parser.add_argument("--useful_columns", type=str, help="useful columns to keep")
|
parser.add_argument("--useful_columns", type=str, help="useful columns to keep")
|
||||||
@@ -38,8 +26,8 @@ print("Argument 3(output cleansed taxi data path): %s" % args.output_cleanse)
|
|||||||
# These functions ensure that null data is removed from the dataset,
|
# These functions ensure that null data is removed from the dataset,
|
||||||
# which will help increase machine learning model accuracy.
|
# which will help increase machine learning model accuracy.
|
||||||
|
|
||||||
useful_columns = [s.strip().strip("'") for s in args.useful_columns.strip("[]").split(r'\;')]
|
useful_columns = eval(args.useful_columns.replace(';', ','))
|
||||||
columns = get_dict(args.columns)
|
columns = eval(args.columns.replace(';', ','))
|
||||||
|
|
||||||
new_df = (raw_data.to_pandas_dataframe()
|
new_df = (raw_data.to_pandas_dataframe()
|
||||||
.dropna(how='all')
|
.dropna(how='all')
|
||||||
|
|||||||
Reference in New Issue
Block a user