-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPandas.py
More file actions
27 lines (22 loc) · 808 Bytes
/
Pandas.py
File metadata and controls
27 lines (22 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pandas as pd
def read_demo():
# df = pd.read_csv("/Users/lanzy/Downloads/student+performance/student/student-mat.csv", sep=";")
# df.columns = df.columns.str.strip()
# print(df)
# print(df.head())
# print(df.iloc[1])
# print(df.columns)
# print(df[df["age"] > 10].head())
# print(df[df['age'] >10])
# print(df.max())
# print(df.describe())
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data"
column_names = [
"mpg", "cylinders", "displacement", "horsepower",
"weight", "acceleration", "model year", "origin", "car name"
]
df = pd.read_csv(url, names=column_names, delim_whitespace=True, na_values="?")
print(df.head())
print(df.info())
if __name__ == "__main__":
read_demo()