Skip to content

Commit

Permalink
style: format code with Autopep8, Black, ClangFormat, dotnet-format, …
Browse files Browse the repository at this point in the history
…Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf

This commit fixes the style issues introduced in 441d95b according to the output
from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java
Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt,
Scalafmt, StandardJS, StandardRB, swift-format and Yapf.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored May 11, 2024
1 parent 441d95b commit b09f686
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions data_science/data_preprocessing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pandas as pd
import numpy as np
import pandas as pd


def preprocess_data(data):
# Preprocess data using Pandas or NumPy
Expand All @@ -9,14 +10,18 @@ def preprocess_data(data):
data = data.fillna(data.mean())

# Normalize numerical data
numerical_data = data.select_dtypes(include=['int64', 'float64'])
numerical_data = (numerical_data - numerical_data.min()) / (numerical_data.max() - numerical_data.min())
numerical_data = data.select_dtypes(include=["int64", "float64"])
numerical_data = (numerical_data - numerical_data.min()) / (
numerical_data.max() - numerical_data.min()
)

# Encode categorical data
categorical_data = data.select_dtypes(include=['object'])
categorical_data = data.select_dtypes(include=["object"])
encoded_data = pd.get_dummies(categorical_data)

# Concatenate the preprocessed data
preprocessed_data = np.concatenate([numerical_data.values, encoded_data.values], axis=1)
preprocessed_data = np.concatenate(
[numerical_data.values, encoded_data.values], axis=1
)

return preprocessed_data

0 comments on commit b09f686

Please sign in to comment.