Giter Site home page Giter Site logo

kunishou / pandas_100_knocks Goto Github PK

View Code? Open in Web Editor NEW
104.0 104.0 34.0 680 KB

This is a content file for "Pandas 100 Knocks". I don`t offer a license. I own the copyright on this source code.

Home Page: https://qiita.com/kunishou/items/bd5fad9a334f4f5be51c

Jupyter Notebook 100.00%

pandas_100_knocks's Issues

Q8. 文字型変換について

初めまして、pandas100本ノックで勉強させていただいております。

Q8において、dfのpclassの列のデータ型を数値型から文字型に型変換する問題が出てきますが、
pandasのユーザーガイドに記載されていた方法と回答&出力結果が違ってたので認識があってるか
確認させてください。
https://pandas.pydata.org/docs/user_guide/text.html

>>> print(pd.__version__)
1.5.2
>>> print(df['pclass'].astype(str).dtype)
object
>>> print(df['pclass'].astype("unicode").dtype)
object
>>> print(df['pclass'].astype("string").dtype)
string
  1. 回答にある df['pclass'].astype(str).dtypestr というデータ型を指定
    →pandasで解釈できないので 汎用的な? object に変換

  2. "string" というデータ型を指定
    →文字列型に変換

  3. unicode というデータ型を指定
    Unicode string という型に変換してほしいが...

お手数をおかけして恐縮ですが、今の書き方とか内部ではこういう挙動になってるんだよーとか補足があれば
是非ご教授お願い致します。

ソースコードのままの状態の共有について

こんにちは。

ソースコードをZipファイルで提供していますが、特に理由がなければソースコードのまま共有した方が利便性が高いのではと思いました。GitHubはZIPでのダウンロードに対応しているので、アーカイブファイルをアップロードしなくても未解凍の状態で展開できます。

Screen Shot 2023-01-12 at 16 19 49

Q71についての問題文の回答について

初めまして、pandas100本ノックで勉強させていただいております。

Q. 71:df2においてclassでグルーピングし、クラスごとの科目の最大値、最小値、平均値を求める(name列は削除しておく)

との問題についての回答が

df2 =df2.drop('name',axis=1)
print(df2.groupby('class').max())
print(df2.groupby('class').min())
print(df2.groupby('class').median())

となっておりますが、平均値であればmedian()ではなくmean()ではないかなと思ったのですが、こちらは誤植でありますでしょうか?

細かい指摘ではありますがご報告させていただきました。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.