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

clean_data.py 332 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
  1. # %load clean_data.py
  2. import pandas as pd
  3. df = pd.read_csv('data.csv', index_col=0)
  4. print('Original Data format (note data is strings):')
  5. print(df)
  6. print('Turn strings into ints and write out cleaned_data.csv')
  7. for col in df.columns:
  8. df[col] = df[col].str.replace("'", "").astype(float)
  9. print(df)
  10. df.to_csv('cleaned_data.csv')
Tip!

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

Comments

Loading...