<tfoot id='2KYxC'></tfoot>
    • <bdo id='2KYxC'></bdo><ul id='2KYxC'></ul>

      <small id='2KYxC'></small><noframes id='2KYxC'>

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

        pandas :将时间戳转换为 datetime.date

        时间:2023-09-14
          <bdo id='Xdhfn'></bdo><ul id='Xdhfn'></ul>

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

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

                  <tbody id='Xdhfn'></tbody>
                  <tfoot id='Xdhfn'></tfoot>
                • 本文介绍了 pandas :将时间戳转换为 datetime.date的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个包含时间戳数据的 pandas 列

                  I have a pandas column of Timestamp data

                  In [27]: train["Original_Quote_Date"][6] 
                  Out[27]: Timestamp('2013-12-25 00:00:00')
                  

                  如何检查这些对象与 datetime.date 类型的对象的等价性

                  How can check equivalence of these objects to datetime.date objects of the type

                  datetime.date(2013, 12, 25)
                  

                  推荐答案

                  使用.date方法:

                  In [11]: t = pd.Timestamp('2013-12-25 00:00:00')
                  
                  In [12]: t.date()
                  Out[12]: datetime.date(2013, 12, 25)
                  
                  In [13]: t.date() == datetime.date(2013, 12, 25)
                  Out[13]: True
                  

                  <小时>

                  要与 DatetimeIndex(即时间戳数组)进行比较,您需要反过来:


                  To compare against a DatetimeIndex (i.e. an array of Timestamps), you'll want to do it the other way around:

                  In [21]: pd.Timestamp(datetime.date(2013, 12, 25))
                  Out[21]: Timestamp('2013-12-25 00:00:00')
                  
                  In [22]: ts = pd.DatetimeIndex([t])
                  
                  In [23]: ts == pd.Timestamp(datetime.date(2013, 12, 25))
                  Out[23]: array([ True], dtype=bool)
                  

                  这篇关于 pandas :将时间戳转换为 datetime.date的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:两天之间的差异(不包括周末)(以小时为单位) 下一篇:Python 生成日期系列

                  相关文章

                  最新文章

                • <tfoot id='7xzZp'></tfoot>
                  <legend id='7xzZp'><style id='7xzZp'><dir id='7xzZp'><q id='7xzZp'></q></dir></style></legend>

                  <small id='7xzZp'></small><noframes id='7xzZp'>

                • <i id='7xzZp'><tr id='7xzZp'><dt id='7xzZp'><q id='7xzZp'><span id='7xzZp'><b id='7xzZp'><form id='7xzZp'><ins id='7xzZp'></ins><ul id='7xzZp'></ul><sub id='7xzZp'></sub></form><legend id='7xzZp'></legend><bdo id='7xzZp'><pre id='7xzZp'><center id='7xzZp'></center></pre></bdo></b><th id='7xzZp'></th></span></q></dt></tr></i><div id='7xzZp'><tfoot id='7xzZp'></tfoot><dl id='7xzZp'><fieldset id='7xzZp'></fieldset></dl></div>

                        <bdo id='7xzZp'></bdo><ul id='7xzZp'></ul>