1. <tfoot id='qc9O5'></tfoot>

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

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

      2. <small id='qc9O5'></small><noframes id='qc9O5'>

      3. <legend id='qc9O5'><style id='qc9O5'><dir id='qc9O5'><q id='qc9O5'></q></dir></style></legend>

        如何在 Google Cloud ML 上使用 pandas.read_csv?

        How do I use pandas.read_csv on Google Cloud ML?(如何在 Google Cloud ML 上使用 pandas.read_csv?)
            <bdo id='3djzL'></bdo><ul id='3djzL'></ul>
              <tbody id='3djzL'></tbody>
            1. <small id='3djzL'></small><noframes id='3djzL'>

            2. <legend id='3djzL'><style id='3djzL'><dir id='3djzL'><q id='3djzL'></q></dir></style></legend>

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

                1. 本文介绍了如何在 Google Cloud ML 上使用 pandas.read_csv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在 Google Cloud ML 上部署训练脚本.当然,我已将我的数据集(CSV 文件)上传到 GCS 的存储桶中.

                  I'm trying to deploy a training script on Google Cloud ML. Of course, I've uploaded my datasets (CSV files) in a bucket on GCS.

                  我曾经使用 read_csv 从 pandas 导入我的数据,但它似乎不适用于 GCS 路径.

                  I used to import my data with read_csv from pandas, but it doesn't seem to work with a GCS path.

                  我应该如何继续(我想继续使用 pandas)?

                  How should I proceed (I would like to keep using pandas) ?

                  import pandas as pd
                  data = pd.read_csv("gs://bucket/folder/file.csv")
                  

                  输出:

                  ERROR 2018-02-01 18:43:34 +0100 master-replica-0 IOError: File gs://bucket/folder/file.csv does not exist
                  

                  推荐答案

                  您将需要使用 tensorflow.python.lib.io 中的 file_io 来执行此操作,如图所示下面:

                  You will require to use file_io from tensorflow.python.lib.io to do that as demonstrated below:

                  from tensorflow.python.lib.io import file_io
                  from pandas.compat import StringIO
                  from pandas import read_csv
                  
                  # read csv file from google cloud storage
                  def read_data(gcs_path):     
                     file_stream = file_io.FileIO(gcs_path, mode='r')
                     csv_data = read_csv(StringIO(file_stream.read()))
                     return csv_data
                  

                  现在调用上面的函数

                   gcs_path = 'gs://bucket/folder/file.csv' # change path according to your bucket, folder and path
                   df = read_data(gcs_path)
                   # print(df.head()) # displays top 5 rows including headers as default
                  

                  这篇关于如何在 Google Cloud ML 上使用 pandas.read_csv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)
                  <i id='x1FkW'><tr id='x1FkW'><dt id='x1FkW'><q id='x1FkW'><span id='x1FkW'><b id='x1FkW'><form id='x1FkW'><ins id='x1FkW'></ins><ul id='x1FkW'></ul><sub id='x1FkW'></sub></form><legend id='x1FkW'></legend><bdo id='x1FkW'><pre id='x1FkW'><center id='x1FkW'></center></pre></bdo></b><th id='x1FkW'></th></span></q></dt></tr></i><div id='x1FkW'><tfoot id='x1FkW'></tfoot><dl id='x1FkW'><fieldset id='x1FkW'></fieldset></dl></div>

                    <tbody id='x1FkW'></tbody>
                  • <bdo id='x1FkW'></bdo><ul id='x1FkW'></ul>

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

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