This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useContext } from "react"; | |
import { TodoContext } from "../context/TodoContext"; | |
import { REMOVE_TODO } from "./../context/ActionTypes"; | |
const TodoList = () => { | |
const { todos, dispatch } = useContext(TodoContext); | |
return ( | |
<div> | |
<h2>Todo List</h2> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useReducer, useContext, useState } from "react"; | |
import { v4 } from "uuid"; | |
import { ADD_TODO } from "./../context/ActionTypes"; | |
import { TodoContext } from "../context/TodoContext"; | |
const TodoForm = () => { | |
const [task, setTask] = useState("") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import LinearRegression | |
lin_reg = LinearRegression() | |
lin_reg.fit(X,Y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataset = pd.read_csv('Salaries.csv') | |
X = dataset.iloc[:,1:2].values | |
Y = dataset.iloc[:,2].values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.compose import ColumnTransformer | |
from sklearn.preprocessing import OneHotEncoder | |
ct = ColumnTransformer(transformers=[('encoder', OneHotEncoder(), [0])], remainder='passthrough') | |
X = np.array(ct.fit_transform(X)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.preprocessing import StandardScaler | |
sc = StandardScaler() | |
X_train[:, 3:] = sc.fit_transform(X_train[:, 3:]) | |
X_test[:, 3:] = sc.transform(X_test[:, 3:]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To delete rows | |
data = pd.read_csv("data.csv", index_col ="Name" ) | |
data.drop(["Mark","Wick", "Jonas"],inplace = True) | |
#To delete columns | |
data.drop(["Name", "City"], axis = 1, inplace = True) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.preprocessing import StandardScaler | |
sc = StandardScaler() | |
X_train[:, 3:] = sc.fit_transform(X_train[:, 3:]) | |
X_test[:, 3:] = sc.transform(X_test[:, 3:]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.preprocessing import LabelEncoder | |
le = LabelEncoder() | |
y = le.fit_transform(y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.impute import SimpleImputer | |
imputer = SimpleImputer(missing_values=np.nan, strategy='mean') | |
imputer.fit(X[:, 1:3]) | |
X[:, 1:3] = imputer.transform(X[:, 1:3]) | |
print(X) |
NewerOlder