如何访问Google Colaboratory根文件夹中的csv文件?

时间:2018-01-07 21:58:50

标签: python pandas google-colaboratory

我正在尝试访问上传的CSV文件,该文件位于我的python笔记本来自colaboratory的同一文件夹中。

当我这么做时:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <link href="https://gist.githubusercontent.com/auser/2bc34b9abf07f34f602dccd6ca855df1/raw/070d6cd5b4d4ec1a3e6892d43e877039a91a9108/timeline.css" rel="stylesheet" type="text/css" />
  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

  <title>Time Line App</title>
  <!-- Script tags including React -->

  <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.2.0/umd/react.production.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.2.0/umd/react-dom.production.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>

</head>

<body>
  <div id="app"></div>
  <script type="text/babel">
    class App extends React.Component { render() { return (
    <div className="notificationsFrame">
      <div className="panel">
        <Header />
        <Content />
      </div>
    </div>
    ) } } class Header extends React.Component { render() { return (
    <div className="header">
      <div className="fa fa-more"></div>
      <span className="title">Timeline</span>
      <input type="text" className="searchInput" placeholder="Search ..." />
      <div className="fa fa-search searchIcon"></div>
    </div>
    ) } } class Content extends React.Component { render() { return (
    <div className="content">
      <div className="line"></div>
      {/* Timeline item */}
      <div className="item">
        <div className="avatar">
          <img alt='Doug' src="http://www.croop.cl/UI/twitter/images/doug.jpg" /> Doug
        </div>
        <span className="time">
An hour ago
</span>
        <p>Ate lunch</p>
        <div className="commentCount">
          2
        </div>
      </div>
      {/* ... */}
    </div>
    ) } } var mount = document.querySelector('#app'); ReactDOM.render(
    <App />, mount);
  </script>
</body>

</html>

它抛出了我:&#34;文件b&#39; train.csv&#39;不存在&#34;错误。

非常感谢任何想法。

1 个答案:

答案 0 :(得分:0)

上传文件时。它未保存在当前文件夹中。

uploaded = files.upload()

它作为uploaded字典中的值存储,文件名为密钥。