mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-12 19:00:43 -04:00
60 lines
1.3 KiB
Markdown
60 lines
1.3 KiB
Markdown
---
|
|
id: 5e9a093a74c4063ca6f7c162
|
|
title: CSV や TXT のデータの読み取り
|
|
challengeType: 11
|
|
videoId: ViGEv0zOzUk
|
|
bilibiliIds:
|
|
aid: 505575354
|
|
bvid: BV1tg411c7GH
|
|
cid: 409020451
|
|
dashedName: reading-data-csv-and-txt
|
|
---
|
|
|
|
# --description--
|
|
|
|
*動画で説明しているように、notebooks.ai を使用する代わりに Google Colab を使用することができます。*
|
|
|
|
その他のリソース:
|
|
|
|
- <a href="https://github.com/krishnatray/RDP-Reading-Data-with-Python-and-Pandas" target="_blank" rel="noopener noreferrer nofollow">GitHub のノート</a>
|
|
- <a href="https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb" target="_blank" rel="noopener noreferrer nofollow">Google Colab を使用して GitHub からノートを開く方法</a>
|
|
|
|
# --question--
|
|
|
|
## --text--
|
|
|
|
Pandas モジュールを使用して CSV ファイル `data.csv` をインポートし、DataFrame に格納するにはどうすればよいですか?
|
|
|
|
## --answers--
|
|
|
|
```python
|
|
import pandas as pd
|
|
df = pd.csv("data.csv")
|
|
```
|
|
|
|
---
|
|
|
|
```python
|
|
import pandas as pd
|
|
df = pd.read_csv("data.csv")
|
|
```
|
|
|
|
---
|
|
|
|
```python
|
|
import pandas as pd
|
|
pd.read_csv("data.csv")
|
|
```
|
|
|
|
---
|
|
|
|
```python
|
|
import pandas as pd
|
|
df = pd.csv_reader("data.csv")
|
|
```
|
|
|
|
## --video-solution--
|
|
|
|
2
|
|
|