I want to change the local setting (to change the date format) in GoogleCollab
The following works for me in JupyterNotebook but not in GoogleColab:
locale.setlocale(locale.LC_TIME, 'de_DE.UTF-8')
It always returns the error: unsupported locale setting
I have already looked at many other solutions and tried everything. One solution to change only the time zone I have seen is this one:
'!rm /etc/localtime
!ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
!date
Using local runtimes 🖥 This way, you can execute code on your local hardware and access your local file system without leaving the Colab notebook. The following documentation goes deeper into the way it works.
Select Aide > Afficher en anglais . Goodluck! Show activity on this post. The language presented is based on browser settings, so you'll want to change the language settings in your browser.
I figured this one out after a long time:
Colab
, you will have to install the desired locale
s. You do this with:!sudo dpkg-reconfigure locales
268
and 269
for Hungarian.268 269
.default locale
, after installation. Here you will need to select your desired custom locale
. This time, it is a numeric selection out of 3-5
options, depending, on how many have you selected at the previous step. In my case, I have selected 3
, and the default locale
became hu_HU
.Colab
runtime: Ctrl + M
then .
locale
:import locale
locale.setlocale(locale.LC_ALL, 'hu_HU')
<- make sure you do it for the LC_ALL
context.locale
is now ready to use with pandas
:pd.to_datetime('2021-01-01').day_name()
returns Friday
, butpd.to_datetime('2021-01-01').day_name('hu_HU')
returns Péntek
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With