wwq
wwq

Reputation: 1

How to retrieve excel files through user input?

I hope that I am able to manually access my local files to retrieve my files(csv/xlsx) and put it in a data frame.

import pandas as pd
from textblob import TextBlob

df = pd.read_excel("(Nov 2017) Case Download Export.xlsx")

df["Problem Description"]
df["Lowercase"] = df["Problem Description"].apply(lambda x: " " .join(word.lower() for word in str(x).split()))

df.to_csv("Oct17.csv", index = None, header=True)

The code that I did is manually entered the file name and load. I hope to browse and select the files myself.

Upvotes: 0

Views: 50

Answers (1)

akhetos
akhetos

Reputation: 706

mypath = "C:\\..."   #folder with all your file
files_name= [f for f in listdir(mypath) if isfile(join(mypath, f))]

file name give you a list with the name of all the file in the folder

Upvotes: 1

Related Questions