python programming in data science code example

Example 1: python for data science

from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPRegressor

df=pd.read_csv('your_dataset')
X_train, X_test, y_train, y_test = train_test_split(feature,
                                                    target,
                                                    test_size=0.2,
                                                    random_state=4)
MLPRegressor.fit(X_trian,y_train)
y_predicted=MLPRegressor.predict(X_test)
# use r2 scores for regression or other measurements
r2_score(y_test,y_predicted)

Example 2: python for data science

#!/usr/bin/python

print "Hello, Python!"