python
Back to Snippets
Python Read CSV with Arabic Date Translation
Read CSV files with pandas and parse Arabic dates using dateparser.
python
import pandas as pd
import dateparser
df = pd.read_csv('data.csv')
# Parse Arabic dates to datetime
df['date_parsed'] = df['date_column'].apply(
lambda x: dateparser.parse(x, languages=['ar'])
)
# Read UTF-16 encoded file
with open('encoded_file.txt', encoding='utf-16-le') as f:
content = f.read()