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

    <bdo id='5J0g9'></bdo><ul id='5J0g9'></ul>

<small id='5J0g9'></small><noframes id='5J0g9'>

<legend id='5J0g9'><style id='5J0g9'><dir id='5J0g9'><q id='5J0g9'></q></dir></style></legend>

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

        如何將年、月和日列合并到單個日期時間列?

        How to combine year, month, and day columns to single datetime column?(如何將年、月和日列合并到單個日期時間列?)

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

              <bdo id='O3xpQ'></bdo><ul id='O3xpQ'></ul>

              1. <legend id='O3xpQ'><style id='O3xpQ'><dir id='O3xpQ'><q id='O3xpQ'></q></dir></style></legend>
                  <tbody id='O3xpQ'></tbody>
                  <tfoot id='O3xpQ'></tfoot>
                  <i id='O3xpQ'><tr id='O3xpQ'><dt id='O3xpQ'><q id='O3xpQ'><span id='O3xpQ'><b id='O3xpQ'><form id='O3xpQ'><ins id='O3xpQ'></ins><ul id='O3xpQ'></ul><sub id='O3xpQ'></sub></form><legend id='O3xpQ'></legend><bdo id='O3xpQ'><pre id='O3xpQ'><center id='O3xpQ'></center></pre></bdo></b><th id='O3xpQ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='O3xpQ'><tfoot id='O3xpQ'></tfoot><dl id='O3xpQ'><fieldset id='O3xpQ'></fieldset></dl></div>
                  本文介紹了如何將年、月和日列合并到單個日期時間列?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有以下數據框df:

                          id  lat        lon      year    month   day         
                  0       381 53.30660   -0.54649 2004    1       2       
                  1       381 53.30660   -0.54649 2004    1       3            
                  2       381 53.30660   -0.54649 2004    1       4   
                  

                  我想創建一個新列 df['Date'],其中 yearmonthday 列按 yyyy-md 格式組合.

                  and I want to create a new column df['Date'] where the year, month, and day columns are combined according to the format yyyy-m-d.

                  在這篇文章之后,我做到了:

                  `df['Date']=pd.to_datetime(df['year']*10000000000
                                             +df['month']*100000000
                                             +df['day']*1000000,
                                             format='%Y-%m-%d%')`
                  

                  結果不是我預期的,因為它是從 1970 年而不是 2004 年開始的,而且它還包含我沒有指定的小時戳:

                  The result is not what I expected, as it starts from 1970 instead of 2004, and it also contains the hour stamp, which I did not specify:

                          id  lat        lon      year    month   day  Date           
                  0       381 53.30660   -0.54649 2004    1       2    1970-01-01 05:34:00.102    
                  1       381 53.30660   -0.54649 2004    1       3    1970-01-01 05:34:00.103         
                  2       381 53.30660   -0.54649 2004    1       4    1970-01-01 05:34:00.104
                  

                  由于日期應該是 2004-1-2 格式,我做錯了什么?

                  As the dates should be in the 2004-1-2 format, what am I doing wrong?

                  推薦答案

                  有一個更簡單的方法:

                  In [250]: df['Date']=pd.to_datetime(df[['year','month','day']])
                  
                  In [251]: df
                  Out[251]:
                      id      lat      lon  year  month  day       Date
                  0  381  53.3066 -0.54649  2004      1    2 2004-01-02
                  1  381  53.3066 -0.54649  2004      1    3 2004-01-03
                  2  381  53.3066 -0.54649  2004      1    4 2004-01-04
                  

                  來自 文檔:

                  從 DataFrame 的多列中組裝日期時間.按鍵可以是常見的縮寫,如 [yearmonthdayminutesecondmsusns])或相同的復數形式

                  Assembling a datetime from multiple columns of a DataFrame. The keys can be common abbreviations like [year, month, day, minute, second, ms, us, ns]) or plurals of the same

                  這篇關于如何將年、月和日列合并到單個日期時間列?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造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(分發帶有已編譯動態共享庫的 Python 包)
                  <tfoot id='ubasI'></tfoot>
                      <bdo id='ubasI'></bdo><ul id='ubasI'></ul>
                        <tbody id='ubasI'></tbody>

                    • <small id='ubasI'></small><noframes id='ubasI'>

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

                            <legend id='ubasI'><style id='ubasI'><dir id='ubasI'><q id='ubasI'></q></dir></style></legend>
                          1. 主站蜘蛛池模板: 天天干 夜夜操 | 国产在线播放一区二区三区 | 亚洲精品专区 | 亚洲欧美日韩精品久久亚洲区 | 日韩一区二区免费视频 | 国产成人综合一区二区三区 | 亚洲社区在线 | 99久久婷婷国产综合精品 | 久久久久久国产精品免费免费 | 天天操天天干天天曰 | 天天操天天天干 | 在线免费中文字幕 | 黄色三级毛片 | 久久99精品久久久久久 | 欧美人妇做爰xxxⅹ性高电影 | 二区三区视频 | 成人av鲁丝片一区二区小说 | av在线免费观看网站 | h免费观看| 99免费精品视频 | 欧美精品一区二区三区四区 | 久久久久亚洲av毛片大全 | 亚洲国产欧美精品 | 在线免费观看a级片 | 99久久免费精品国产男女高不卡 | 国产高清在线视频 | 国产精品久久av | 日韩精品在线观看免费 | 欧美精品一区二区三区在线播放 | 成人综合视频在线 | h视频免费看| 国产精品美女久久久久久久久久久 | 日韩国产欧美 | 国产成人精品久久二区二区91 | 999久久久 | 久久丁香 | av香蕉| 日韩有码在线播放 | 欧美激情国产日韩精品一区18 | 99久久久久久久久 | www日韩 |