質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
import

自身のプラットフォーム・プログラム・データセットに対して、外部ソースを取り込むプロセスをimportと呼びます。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

pandas

Pandasは、PythonでRにおけるデータフレームに似た型を持たせることができるライブラリです。 行列計算の負担が大幅に軽減されるため、Rで行っていた集計作業をPythonでも比較的簡単に行えます。 データ構造を変更したりデータ分析したりするときにも便利です。

Q&A

解決済

1回答

9084閲覧

外部モジュールをインストールしたらpandasがインポートできなくなった

Kose23

総合スコア3

import

自身のプラットフォーム・プログラム・データセットに対して、外部ソースを取り込むプロセスをimportと呼びます。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

pandas

Pandasは、PythonでRにおけるデータフレームに似た型を持たせることができるライブラリです。 行列計算の負担が大幅に軽減されるため、Rで行っていた集計作業をPythonでも比較的簡単に行えます。 データ構造を変更したりデータ分析したりするときにも便利です。

0グッド

0クリップ

投稿2021/01/21 00:54

編集2021/01/21 00:56

前提・実現したいこと

google colaboratoryを使用して、以下のモジュールをインストールしました。
https://github.com/vishaalagartha/basketball_reference_scraper/blob/master/API.md#get_rosterteam-season

このページの一番上のget_rosterを試したのですが、うまくいきませんでした。

発生している問題・エラーメッセージ

ImportError Traceback (most recent call last) <ipython-input-11-89420c948daf> in <module>() ----> 1 get_roster('DAL', 2019) 10 frames /usr/local/lib/python3.6/dist-packages/pandas/core/computation/expressions.py in <module>() 13 from pandas._config import get_option 14 ---> 15 from pandas._libs.lib import values_from_object 16 17 from pandas.core.dtypes.generic import ABCDataFrame ImportError: cannot import name 'values_from_object'

該当のソースコード

!pip install basketball-reference-scraper

python

1from basketball_reference_scraper.teams import get_roster, get_team_stats, get_opp_stats, get_roster_stats, get_team_misc 2get_roster('DAL', 2019)

###補足

!pip install basketball-reference-scraper

を行ったときに

ERROR: tensorflow 2.4.0 has requirement numpy~=1.19.2, but you'll have numpy 1.18.1 which is incompatible. ERROR: tensorflow 2.4.0 has requirement six~=1.15.0, but you'll have six 1.13.0 which is incompatible. ERROR: nbclient 0.5.1 has requirement jupyter-client>=6.1.5, but you'll have jupyter-client 5.3.5 which is incompatible. ERROR: google-colab 1.0.0 has requirement pandas~=1.1.0; python_version >= "3.0", but you'll have pandas 0.25.3 which is incompatible. ERROR: google-colab 1.0.0 has requirement requests~=2.23.0, but you'll have requests 2.22.0 which is incompatible. ERROR: google-colab 1.0.0 has requirement six~=1.15.0, but you'll have six 1.13.0 which is incompatible. ERROR: fbprophet 0.7.1 has requirement pandas>=1.0.4, but you'll have pandas 0.25.3 which is incompatible. ERROR: datascience 0.10.6 has requirement folium==0.2.1, but you'll have folium 0.8.3 which is incompatible. ERROR: albumentations 0.1.12 has requirement imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible. Installing collected packages: lxml, six, numpy, pytz, pandas, soupsieve, idna, requests, beautifulsoup4, basketball-reference-scraper Found existing installation: lxml 4.2.6 Uninstalling lxml-4.2.6: Successfully uninstalled lxml-4.2.6 Found existing installation: six 1.15.0 Uninstalling six-1.15.0: Successfully uninstalled six-1.15.0 Found existing installation: numpy 1.19.5 Uninstalling numpy-1.19.5: Successfully uninstalled numpy-1.19.5 Found existing installation: pytz 2018.9 Uninstalling pytz-2018.9: Successfully uninstalled pytz-2018.9 Found existing installation: pandas 1.1.5 Uninstalling pandas-1.1.5: Successfully uninstalled pandas-1.1.5 Found existing installation: idna 2.10 Uninstalling idna-2.10: Successfully uninstalled idna-2.10 Found existing installation: requests 2.23.0 Uninstalling requests-2.23.0: Successfully uninstalled requests-2.23.0 Found existing installation: beautifulsoup4 4.6.3 Uninstalling beautifulsoup4-4.6.3: Successfully uninstalled beautifulsoup4-4.6.3 Successfully installed basketball-reference-scraper-1.0.26 beautifulsoup4-4.8.2 idna-2.8 lxml-4.4.2 numpy-1.18.1 pandas-0.25.3 pytz-2019.3 requests-2.22.0 six-1.13.0 soupsieve-1.9.5 WARNING: The following packages were previously imported in this runtime: [numpy,pandas,pytz,six] You must restart the runtime in order to use newly installed versions.

というメッセージが表示されました。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Daregada

2021/01/21 01:49

> You must restart the runtime in order to use newly installed versions. この後、ランタイムの再起動を行ないましたか? コメントではなく、質問を編集して情報を追加してください。
guest

回答1

0

ベストアンサー

Google Colabで新しいノートブックを開いて、

Python

1!pip install unidecode 2!pip install basketball-reference-scraper

を実行してインストール後、「RESTART RUNTIME」をクリックするか、メニューの「ランタイム」→「ランタイムを再起動」を選択する。

その後、

Python

1from basketball_reference_scraper.teams import get_roster, get_team_stats, get_opp_stats, get_roster_stats, get_team_misc 2get_roster('DAL', 2019)

を実行すると、以下のような結果(先頭部分のみキャプチャ)が得られた。

サンプル画像

投稿2021/01/21 02:21

Daregada

総合スコア11990

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Kose23

2021/01/21 08:53

うまくいきました! ありがとうございます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問