LoginSignup
5
14

More than 5 years have passed since last update.

【Python】データの前処理を行うためのPandasチートシート

Posted at

やりたいこと

  • Pythonを利用してデータの前処理を行う際の、pandasのチートシートを用意する
    • CSVデータの読み込み(read csv):read_csv
    • データの閲覧(see nth data)
    • 指定した行の一部の文字を変換(convert string into "") :str.replace()
    • 指定した文字の後をすべて削除する(remove all string after string):
    • 指定した列の削除(drop certain rows):df.drop
    • 重複行の存在を確認(check if duplicated rows exist):duplicated().any()
    • 重複行の削除(remove duplicated rows):drop_duplicates
    • 特定の文字列の値を含んでいる行を検索する(get rows which contains certain string)
    • 列の含む数字が大きい順番に並べる(sort)
    • 列の並び替え(replace columns):
    • 文字列オブジェクトからnumericalに変換(convert string into numerical)
    • 行の数を数えたい(count number of rows)
    • 整形済みデータを新たなCSVに保存する(save csv)

ソースコード

  • 下記の記事を参考にしてください

Pandas データの前処理で使えるチートシート
https://review-of-my-life.blogspot.jp/2017/10/pandas-cheetsheet.html

5
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
14