I am trying to write a python script that will grab multiple different csv files from an input folder, then create a list of dataframes and display them as powerbi tables in power bi. The below script is not loading any tables into powerbi:
import os
import numpy as np
import pandas as pd
import psycopg2
#path = input(r'Enter path where csv files are located :') "\\"
path = r'C:\Users\admin\Downloads\Data analysis case study'
csv_files = [os.path.join(path "\\", file) for file in os.listdir(path) if file.endswith('.csv')]
df=[]
for d in csv_files:
df.append(pd.read_csv(d))
df
Also, does someone know how to connect this python script to accept a folder path input from a power bi parameter?
CodePudding user response: