- read_csv
Planets - Read CSV into Dataframes
examples/pandas/read_csv.py
import sys import pandas as pd filename = "planets.csv" if len(sys.argv) == 2: filename = sys.argv[1] df = pd.read_csv(filename) print(df) print() print(type(df)) print(df.__class__.__name__)
Planet name Distance (AU) Mass 0 Mercury 0.40 0.055000 1 Venus 0.70 0.815000 2 Earth 1.00 1.000000 3 Mars 1.50 0.107000 4 Ceres 2.77 0.000150 5 Jupiter 5.20 318.000000 6 Saturn 9.50 95.000000 7 Uranus 19.60 14.000000 8 Neptune 30.00 17.000000 9 Pluto 39.00 0.002180 10 Charon 39.00 0.000254 <class 'pandas.core.frame.DataFrame'> DataFrame