0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pandas読込

Last updated at Posted at 2020-12-19

読込〜格納確認

# Pandasの読み込み
import pandas as pd

# ファイルの読み込み
df = pd.read_csv('bank.csv')

# .tsv形式 sepの指定が必要
# df = pd.read_csv('data.tsv', sep = "\t")

# 格納の確認
df.head() # 上から
# df.tail() # 下から

中身の確認

# 中身の確認
print(df.info()) # 全体
print(df.shape) # 行数と列数
print(df.dtypes) # データタイプ
print(df.columns) # 説明変数

統計量の確認

# 数値型の統計量
# count mean std min Quartile
df.describe()

# object型の統計量
# count unique top freq
df.describe(include=[object])

欠損確認

# 欠損値

# 行(axis=1)に欠損値が含まれるか
print(df.isnull().any(axis=1))
# 欠損値個数
print(df.isnull().sum(axis=1))
# 多いもの順にソート
print(df.isnull().sum(axis=1).sort_values(ascending=False))


print("===========================================")

# 列(axis=0)に欠損値が含まれるか
print(df.isnull().any(axis=0))
# 欠損値個数
print(df.isnull().sum(axis=0))
# 多いもの順にソート
print(df.isnull().sum(axis=0).sort_values(ascending=False))
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?