Screen Link:
https://app.dataquest.io/m/293/data-cleaning-basics/12/challenge-clean-a-string-column
My Code:
aptops[“weight”]= laptops[“weight”].str.replace(“kgs”,"").str.replace(“kg”,"").astype(float)
laptops.rename({“weight”: “weight_kg”}, axis = 1, inplace = True)
laptops.to_csv(‘laptops_cleaned.csv’, index = False)
Replace this line with your code
What I expected to happen:
What actually happened:
Replace this line with the output/error
As per this mission, I’ve replaced the strings followed by renamed the column as well and finally saved the cleaned csv file as per csv method - laptops.to_csv(‘laptops_cleaned.csv’, index = False)
Now I just want to understand where will i see the cleaned csv file for my further analysis? Your help is highly appreciated ?
Thank you
K!
- Run the code first using Run Code or Submit Answer
- click Open Console
- run
!ls
to list files/directories
This will list the files in the working directory
>>> !ls
laptops_cleaned.csv laptops.csv
- if you want to check the contents in
laptops_cleaned.csv
you can use !cat laptops_cleaned.csv
>>> !cat laptops_cleaned.csv
You can copy and paste the output to a CSV file in your machine.
OR
If you need the laptops_cleaned.csv
in your machine, you can download the laptops.csv
then use your favorite text editor or notebook to run the code you wrote to generate laptops_cleaned.csv
I hope this has helped. 
1 Like
Thanks for the clarification. I got it now 
Best
K!
1 Like
Awesome, I’m glad I could help.
1 Like
Hi @info.victoromondi
i try the way you said above, i try to do " !cat laptops_cleaned.csv’, it is said no such file or dictionary.
screen link: https://app.dataquest.io/m/293/data-cleaning-basics/12/challenge-clean-a-string-column
Follow either of the instructions
You might have named it laptops_cleaned
instead of laptops_cleaned.csv
while saving the laptops dataframe.
Refer the code below: You might have written
laptops.to_csv('laptops_cleaned', index=False)
instead of
laptops.to_csv('laptops_cleaned.csv', index=False)