Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

match_columns.py 558 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  1. from typing import Tuple
  2. import numpy as np
  3. import pandas as pd
  4. from feature_engine.preprocessing import MatchVariables
  5. # --------------------------------------
  6. # 学習データとテストデータのカラムを一致させる
  7. # --------------------------------------
  8. def match_columns(
  9. train: pd.DataFrame,
  10. test: pd.DataFrame,
  11. ) -> Tuple[pd.DataFrame, pd.DataFrame]:
  12. match_cols = MatchVariables(
  13. missing_values="ignore"
  14. )
  15. match_cols.fit(train)
  16. test = match_cols.transform(test)
  17. return train, test
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...