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

    • <bdo id='osQNc'></bdo><ul id='osQNc'></ul>
  • <small id='osQNc'></small><noframes id='osQNc'>

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

        <legend id='osQNc'><style id='osQNc'><dir id='osQNc'><q id='osQNc'></q></dir></style></legend>
      1. 為 pandas.read_csv 指定正確的 dtypes 以獲取日期時間

        Specify correct dtypes to pandas.read_csv for datetimes and booleans(為 pandas.read_csv 指定正確的 dtypes 以獲取日期時間和布爾值)

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

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

                <legend id='hQTZr'><style id='hQTZr'><dir id='hQTZr'><q id='hQTZr'></q></dir></style></legend>

                    <tbody id='hQTZr'></tbody>
                1. 本文介紹了為 pandas.read_csv 指定正確的 dtypes 以獲取日期時間和布爾值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在將 csv 文件加載到 Pandas DataFrame 中.對于每一列,如何使用 dtype 參數指定它包含的數據類型?

                  I am loading a csv file into a Pandas DataFrame. For each column, how do I specify what type of data it contains using the dtype argument?

                  • 我可以使用 numeric 數據(代碼在底部)...
                  • 但是如何指定時間數據...
                  • 分類數據,例如因子或布爾值?我試過 np.bool_pd.tslib.Timestamp 沒有運氣.
                  • I can do it with numeric data (code at bottom)...
                  • But how do I specify time data...
                  • and categorical data such as factors or booleans? I have tried np.bool_ and pd.tslib.Timestamp without luck.

                  代碼:

                  import pandas as pd
                  import numpy as np
                  df = pd.read_csv(<file-name>, dtype={'A': np.int64, 'B': np.float64})
                  

                  推薦答案

                  read_csv 有很多選項可以處理你提到的所有情況.您可能想嘗試 dtype={'A': datetime.datetime},但通常您不需要 dtypes,因為 pandas 可以推斷類型.

                  There are a lot of options for read_csv which will handle all the cases you mentioned. You might want to try dtype={'A': datetime.datetime}, but often you won't need dtypes as pandas can infer the types.

                  對于日期,則需要指定 parse_date 選項:

                  parse_dates : boolean, list of ints or names, list of lists, or dict
                  keep_date_col : boolean, default False
                  date_parser : function
                  

                  一般來說,要轉換布爾值,您需要指定:

                  true_values  : list  Values to consider as True
                  false_values : list  Values to consider as False
                  

                  這會將列表中的任何值轉換為布爾值 true/false.對于更一般的轉換,您很可能需要

                  Which will transform any value in the list to the boolean true/false. For more general conversions you will most likely need

                  轉換器:字典.用于轉換某些列中的值的可選函數字典.鍵可以是整數或列標簽

                  converters : dict. optional Dict of functions for converting values in certain columns. Keys can either be integers or column labels

                  雖然密集,但請在此處查看完整列表:http://pandas.pydata.org/pandas-docs/stable/generated/pandas.io.parsers.read_csv.html

                  Though dense, check here for the full list: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.io.parsers.read_csv.html

                  這篇關于為 pandas.read_csv 指定正確的 dtypes 以獲取日期時間和布爾值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

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

                          <tbody id='X6cVe'></tbody>

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

                            <legend id='X6cVe'><style id='X6cVe'><dir id='X6cVe'><q id='X6cVe'></q></dir></style></legend>

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

                          • 主站蜘蛛池模板: a毛片视频网站 | 亚洲一区二区在线视频 | 91大神在线资源观看无广告 | 亚洲欧美一区二区三区在线 | 在线观看中文字幕dvd播放 | 久久精品国产一区二区电影 | 日本高清精品 | 色久五月 | 久久成人精品视频 | 国产精品污www一区二区三区 | 亚洲精品在线免费 | 玖玖综合在线 | 日韩一区二区三区av | 久久久久国产 | 性一交一乱一伦视频免费观看 | 欧美色综合一区二区三区 | 国产日韩视频 | 九九九久久国产免费 | 国产精品久久久亚洲 | 超碰日本 | 欧美一级欧美三级在线观看 | 国产一区二区三区免费 | 久久a久久 | 久草在线 | 欧美视频免费在线观看 | 中文字幕一区二区三区四区五区 | 久久久激情视频 | 国产精品久久久久久久久免费高清 | 国产一级淫片免费视频 | 日韩精品免费在线观看 | 在线成人| 欧美在线观看一区二区 | 97影院在线午夜 | 男人的天堂亚洲 | 成年人精品视频在线观看 | 亚洲欧美日韩一区二区 | 亚洲免费在线观看 | 欧美三级免费观看 | av综合站| 青青激情网 | 午夜视频免费在线 |