pyprecag.describe¶
-
class
pyprecag.describe.
CsvDescribe
(csv_filename)[source]¶
-
class
pyprecag.describe.
VectorDescribe
(input_data)[source]¶
-
pyprecag.describe.
get_column_properties
(dataframe)[source]¶ - Get a dictionary representing Column Properties for a pandas dataframe or a geopandas geodataframe.
- Includes:
- alias - removes spaces and replaces unicode chars with a sensible string using unidecode. ie oC to degC shapefile - An ESRI compatible 10 char alpha-numeric (excludes ‘-‘ & ‘_’) column name. type - The fiona compatible column type dtype - The Pandas/Geopandas compatible column type.
At Present it does not store the column width precision etc.
Parameters: dataframe ([pandas.core.frame.DataFrame or geopandas.geodataframe.GeoDataFrame]) – Returns: Representing properties of a column. Return type: collections.OrderedDict - TODO: Consider converting to a dictionary class with the get_shapefile_column_names etc
- see: https://stackoverflow.com/questions/1305532/convert-python-dict-to-object
-
pyprecag.describe.
get_esri_shapefile_schema
(inputGeoDataFrame)[source]¶ - Construct an esri compatible schema for use with fiona.
- remaps to fiona dtypes
- Adheres to ESRI column naming standards - 10 alpha numeric characters including ‘_’ underscore.
Parameters: inputGeoDataFrame (geopandas.GeoDataframe) – Returns (dict): A Fiona compatible Dictionary
-
pyprecag.describe.
predictCoordinateColumnNames
(column_names)[source]¶ Get the Longitude/easting and latitude/northing columns from a list of column_names
Parameters: column_names (List[str]) – A list of column names Returns: [xColumn,yColumn] Best matched column names Return type: List[str]
-
pyprecag.describe.
save_geopandas_tofile
(inputGeoDataFrame, output_filename, overwrite=True, file_encoding='ascii')[source]¶ - Save a geodataframe to file.
- adds functionality to asses and rename columns to ESRI compatible 10 alpha-numeric characters.
- Maps lists and boolean column types to string.
Parameters: - inputGeoDataFrame (geopandas.geodataframe.GeoDataFrame) – The Geodataframe to save
- output_filename (str) – The output filename
- overwrite (bool) – Overwrite Existing file
- file_encoding (str) – encoding type for output file.