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

load_data.py 808 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. # read the data from data source
  2. # savve it in the data/raw for further processing
  3. import os
  4. from get_data import read_params,get_data
  5. import argparse
  6. def load_and_save(config_path):
  7. config = read_params(config_path)
  8. df = get_data(config_path)
  9. # replacing the space in csv file (header data)
  10. new_cols = [col.replace(" ","_") for col in df.columns]
  11. # storing the replaced data in raw folder. using the params.yaml
  12. raw_data_path = config["load_data"]["raw_dataset_csv"]
  13. df.to_csv(raw_data_path,sep=",",index=False,header=new_cols)
  14. if __name__ == "__main__":
  15. args = argparse.ArgumentParser()
  16. # we just reading the params.yaml
  17. args.add_argument("--config",default = "params.yaml")
  18. parsed_args = args.parse_args()
  19. load_and_save(config_path = parsed_args.config)
Tip!

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

Comments

Loading...