import os
cwd = os.getcwd()
df.to_csv(cwd+ "/BA_reviews.csv")
I didn't understand this code properly. Can someone help?
import os
cwd = os.getcwd()
df.to_csv(cwd+ "/BA_reviews.csv")
I didn't understand this code properly. Can someone help?
On
Tha's just getting the absolute path of the current folder in order to save, from the pandas dataframe, a cvs file into that folder. You can either do the same using the built-in library specific for path operations, pathlib, and f-strings, in a more pythonic way:
import pathlib
cwd = pathlib.Path().absolute()
df.to_csv(f"{cwd}/BA_reviews.csv")
os.getcwddocsso
means read
BA_reviews.csvfrom current working directory.