久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='xCWT5'></small><noframes id='xCWT5'>

    • <bdo id='xCWT5'></bdo><ul id='xCWT5'></ul>
    1. <tfoot id='xCWT5'></tfoot>
    2. <legend id='xCWT5'><style id='xCWT5'><dir id='xCWT5'><q id='xCWT5'></q></dir></style></legend>
      <i id='xCWT5'><tr id='xCWT5'><dt id='xCWT5'><q id='xCWT5'><span id='xCWT5'><b id='xCWT5'><form id='xCWT5'><ins id='xCWT5'></ins><ul id='xCWT5'></ul><sub id='xCWT5'></sub></form><legend id='xCWT5'></legend><bdo id='xCWT5'><pre id='xCWT5'><center id='xCWT5'></center></pre></bdo></b><th id='xCWT5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xCWT5'><tfoot id='xCWT5'></tfoot><dl id='xCWT5'><fieldset id='xCWT5'></fieldset></dl></div>

        python pandas TimeStamps到夏令時(shí)的本地時(shí)間字符串

        python pandas TimeStamps to local time string with daylight saving(python pandas TimeStamps到夏令時(shí)的本地時(shí)間字符串)
      1. <small id='1Kr5f'></small><noframes id='1Kr5f'>

        <tfoot id='1Kr5f'></tfoot>
          <tbody id='1Kr5f'></tbody>
      2. <legend id='1Kr5f'><style id='1Kr5f'><dir id='1Kr5f'><q id='1Kr5f'></q></dir></style></legend>
            <bdo id='1Kr5f'></bdo><ul id='1Kr5f'></ul>

              1. <i id='1Kr5f'><tr id='1Kr5f'><dt id='1Kr5f'><q id='1Kr5f'><span id='1Kr5f'><b id='1Kr5f'><form id='1Kr5f'><ins id='1Kr5f'></ins><ul id='1Kr5f'></ul><sub id='1Kr5f'></sub></form><legend id='1Kr5f'></legend><bdo id='1Kr5f'><pre id='1Kr5f'><center id='1Kr5f'></center></pre></bdo></b><th id='1Kr5f'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1Kr5f'><tfoot id='1Kr5f'></tfoot><dl id='1Kr5f'><fieldset id='1Kr5f'></fieldset></dl></div>

                  本文介紹了python pandas TimeStamps到夏令時(shí)的本地時(shí)間字符串的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有一個(gè)帶有 TimeStamps 列的數(shù)據(jù)框.我想將其轉(zhuǎn)換為本地時(shí)間字符串,即夏令時(shí).

                  I have a dataframe with a TimeStamps column. I want to convert it to strings of local time, ie with daylight saving.

                  所以我想將下面的 ts[0] 轉(zhuǎn)換為2015-03-30 03:55:05".Pandas 似乎知道 DST,但僅當(dāng)您在系列上調(diào)用 .values 時(shí).

                  So I want to convert ts[0] below to "2015-03-30 03:55:05". Pandas seems to be aware of DST, but only when you call .values on the series.

                  謝謝

                  (Pdb) ts = df['TimeStamps']
                  (Pdb) ts
                  0   2015-03-30 02:55:05.993000
                  1   2015-03-30 03:10:20.937000
                  2   2015-03-30 10:09:19.947000
                  Name: TimeStamps, dtype: datetime64[ns]
                  (Pdb) ts[0]
                  Timestamp('2015-03-30 02:55:05.993000')
                  (Pdb) ts.values
                  array(['2015-03-30T03:55:05.993000000+0100',
                     '2015-03-30T04:10:20.937000000+0100',
                     '2015-03-30T11:09:19.947000000+0100'], dtype='datetime64[ns]')
                  

                  推薦答案

                  DST 與您所在的位置相關(guān)(例如,倫敦 DST 比紐約晚幾周開始).您首先需要知道時(shí)間戳?xí)r區(qū):

                  DST is relative to your location (e.g. London DST began a few weeks after NY). You first need to make the timestamp timezone aware:

                  from pytz import UTC
                  from pytz import timezone
                  import datetime as dt
                  
                  ts = pd.Timestamp(datetime.datetime(2015, 3, 31, 15, 47, 25, 901597))
                  # or...
                  ts = pd.Timestamp('2015-03-31 15:47:25.901597')
                  # ts is a Timestamp, but it has no idea where in the world it is...
                  >>> ts.tzinfo is None
                  True
                  
                  # So the timestamp needs to be localized.  Assuming it was originally a UTC timestamp, it can be localized to UTC.
                  ts_utc = ts.tz_localize(UTC)
                  # Once localized, it can be expressed in other timezone regions, e.g.: 
                  eastern = pytz.timezone('US/Eastern')
                  ts_eastern = ts_utc.astimezone(eastern)
                  # And to convert it to an ISO string of local time (e.g. eastern):
                  >>> ts_eastern.isoformat()
                  '2015-03-30T08:09:27.143173-04:00'
                  

                  參見 pytz 或 日期時(shí)間了解更多信息.

                  See pytz or datetime for more information.

                  這篇關(guān)于python pandas TimeStamps到夏令時(shí)的本地時(shí)間字符串的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個(gè)模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點(diǎn)包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復(fù)導(dǎo)入頂級名稱的情況下構(gòu)造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動(dòng)態(tài)共享庫的 Python 包)

                  <small id='POu0r'></small><noframes id='POu0r'>

                        <tbody id='POu0r'></tbody>
                    • <i id='POu0r'><tr id='POu0r'><dt id='POu0r'><q id='POu0r'><span id='POu0r'><b id='POu0r'><form id='POu0r'><ins id='POu0r'></ins><ul id='POu0r'></ul><sub id='POu0r'></sub></form><legend id='POu0r'></legend><bdo id='POu0r'><pre id='POu0r'><center id='POu0r'></center></pre></bdo></b><th id='POu0r'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='POu0r'><tfoot id='POu0r'></tfoot><dl id='POu0r'><fieldset id='POu0r'></fieldset></dl></div>

                    • <legend id='POu0r'><style id='POu0r'><dir id='POu0r'><q id='POu0r'></q></dir></style></legend>

                        <tfoot id='POu0r'></tfoot>
                          <bdo id='POu0r'></bdo><ul id='POu0r'></ul>
                          1. 主站蜘蛛池模板: 日韩视频专区 | 伊人色综合久久久天天蜜桃 | 99久久久国产精品免费消防器 | 成人一区二区三区在线观看 | 天天操操 | 四虎成人免费电影 | 成年人在线观看视频 | 欧美人成在线视频 | 国产视频中文字幕 | 99爱视频 | 久久免费视频在线 | 91精品国产综合久久国产大片 | 91av视频在线观看 | 欧美三级三级三级爽爽爽 | 欧美综合自拍 | 成年视频在线观看福利资源 | 涩色视频在线观看 | 欧美日韩精品 | 成人精品免费视频 | 国产精品成人国产乱 | 黄a大片| 亚洲日日操 | 欧美精品一区二区三 | 欧美激情久久久久久 | 久久精品视频在线播放 | 国产高清一区二区 | 97国产精品视频人人做人人爱 | 日韩成人av在线 | 久久久999免费视频 999久久久久久久久6666 | 欧美久久久久久 | 天天影视网天天综合色在线播放 | 91久久精品一区二区二区 | 久久国产亚洲 | 久久国产精品偷 | 九九热在线观看视频 | 久久tv在线观看 | 99re视频在线观看 | 国产91中文| 欧美在线一级 | 一区二区三区不卡视频 | 久久精品色欧美aⅴ一区二区 |