I have a sample CSV file in the path - /alb/alb_dev/alba/alb_dev/Fls/albb/at/conv in Winscp. When I'm trying to convert .csv file to .xlsx, I'm getting an error saying -
**AttributeError: module 'pandas' has no attribute 'read_csv'**
I tried running the below python code. Can anyone guide what mistake I'm making.
import os
os.chdir('/alb/alb_dev/alba/alb_dev/Fls/albb/at/conv')
import pandas as pd
# The read_csv is reading the csv file into Dataframe
df = pd.read_csv("./samplefile.csv")
# then to_excel method converting the .csv file to .xlsx file.
df.to_excel("samplefile.xlsx", sheet_name="Testing", index=False`
Thanks!
I tried installing **pip install pandas ** and pip-autoremove pandas -y and **pip install pip-autoremove ** This did not work.
Also tried renaming the .csv file and ran the script but it didn't work.
I want to convert .csv file to .xlsx file without any error.