PandasでDataFrame を表示すると、Defaultでは、
indexを含む表示になるのだが・・
# csvファイルを読み込んでデータフレームに展開
df = pd.read_csv('dataset/physical_measurement.csv')
print(df)
Name Height Weight 0 佐藤 172 53 1 田中 160 50 2 鈴木 165 58 3 長谷川 160 65
“print(df.to_string(index=False))” で、Indexを省略することができた。
これは、便利
# csvファイルを読み込んでデータフレームに展開
df = pd.read_csv('dataset/physical_measurement.csv')
print(df.to_string(index=False))
Name Height Weight 佐藤 172 53 田中 160 50 鈴木 165 58 長谷川 160 65
元ネタ:https://stackoverflow.com/questions/24644656/how-to-print-pandas-dataframe-without-index