vuquangnguyen2016 / Webpage

VU QUANG NGUYEN - DH KHTN - 1523030
https://vuquangnguyen2016.github.io/Webpage/
1 stars 0 forks source link

Learning_Python #13

Open vuquangnguyen2016 opened 6 years ago

vuquangnguyen2016 commented 6 years ago

Import Data

import numpy as np import pandas as pd import matplotlib.pyplot as plt

dataset=pd.read_csv('Dataset_Update_NguyenAnhBang.csv')

Drop = Delete Column

dataset=pd.drop('Column 1', axis=1, inplace=True)

Reset_index

df = df.reset_index(drop=True)

Group

dataset.groupby('Catoglory').set_group('C1','C2') or dataset.groupby('Column 1').Column2

Link bai giang

Filter data

dataset['Column1'].unique() Loc data = dataset[ dataset.Column1.isin(['Row 1', 'Row 2']) ]

Regression

import statsmodels.api as sms model = sms.OLS.from_formula('GRADE ~ GPA + TUCE', data=dataset).fit().summary()