data preprocessing module¶
Data preprocessing module.
standardNormalization(geo, field_index)
¶
Standard Normalized a field in the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
geo |
type |
GEO class object that stored spatial data and attributes. |
required |
field_index |
int |
The index of the field to be normalized. |
required |
Exceptions:
Type | Description |
---|---|
TypeError |
[description] |
Source code in mygeopackage/pproc.py
def standardNormalization(geo: type(mygeopackage.Geo),field_index):
"""Standard Normalized a field in the dataset.
Args:
geo (class GEO): GEO class object that stored spatial data and attributes.
field_index (int): The index of the field to be normalized.
Raises:
TypeError: [description]
"""
if not isinstance(geo,mygeopackage.Geo):
raise TypeError
scaler = preprocessing.StandardScaler()
#print(geo.data[:,field_index])
geo.data[:,field_index] = scaler.fit_transform(geo.data[:,field_index].reshape(-1,1)).flatten()
Last update: 2021-05-03