Often, we encounter data that includes special characters with accents or diacritical marks collectively referred to as diacritics. When working with this data, there's often a need to substitute these accented characters with their equivalent non-accented ASCII counterparts.
The exciting news is that this Python package simplifies the process of replacing accented characters with their non-accented ASCII equivalents.
This Python package is compatible with both standard Python and can seamlessly integrate with Pyspark and Spark SQL for your data processing needs.
The package can be installed from the PyPi repository using the below command
pip install replace_accents
Let's delve into detailed examples
1. Python example
# Import the replace accents function
from replace_accents import replace_accents_characters
# Use the function to replace accent characters
replace_accents_characters("crème de la crème")
2. Pyspark example
# Import the replace accents function
from replace_accents import replace_accents_characters
# Import Pyspark col function
from pyspark.sql.functions import col
# Register python function as Pyspark UDF and Spark SQL UDF
replace_accents_characters_pyspark_udf = spark.udf.register("replace_accents_characters_sparksql_udf", replace_accents_characters)
# Create Pyspark Dataframe
df = spark.table("table_name")
# Use Pyspark UDF on the Pyspark dataframe
display(df.select("col1", replace_accents_characters_pyspark_udf(col("col1")).alias("replaced_col1")))
3. Spark SQL example
# Import the replace accents function
from replace_accents import replace_accents_characters
# Register python function as Pyspark UDF and Spark SQL UDF
replace_accents_characters_pyspark_udf = spark.udf.register("replace_accents_characters_sparksql_udf", replace_accents_characters)
# Use Spark SQL UDF in the SQL query
spark.sql("select col1, replace_accents_characters_sparksql_udf(col1) as replaced_col1 from table")
You can get more information about this package here
Metadata
Release files for replace-accents 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| replace_accents-0.0.5.tar.gz | 3.3 kB | Without provenance | Details for replace_accents-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| replace_accents-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for replace_accents-0.0.5-py3-none-any.whl |
Total release size: 7.1 kB
Release files / replace_accents-0.0.5.tar.gz
| Download URL | replace_accents-0.0.5.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c96b1c8c5d996e7a7b28975407c17710b5070bc256a1bfc83a6226aa0fd86979
|
|
BLAKE2b-256 checksum How to use checksums |
b2e11ea7a63e0609b3127e1258f9d5b9a4a4045f22e2b4e2998beee1b7f4ab49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / replace_accents-0.0.5-py3-none-any.whl
| Download URL | replace_accents-0.0.5-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59ad12519d964cdbfd517d0e91ccb1752692f853626ab5362e106724b210c5ca
|
|
BLAKE2b-256 checksum How to use checksums |
08c424ac5d7594dc13b1e062cec4c83f1ca03f6bd3a5ecf7cfb42bf76d72ecde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Security for replace-accents 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.