Skip to content

Instantly share code, notes, and snippets.

@LucasMorettoRodrigues
Created January 7, 2019 19:24
Show Gist options
  • Save LucasMorettoRodrigues/cda0ced6289cdf7e6ecd7505a6eadaa0 to your computer and use it in GitHub Desktop.
Save LucasMorettoRodrigues/cda0ced6289cdf7e6ecd7505a6eadaa0 to your computer and use it in GitHub Desktop.
import_dataset
# FUNÇÃO PARA IMPORTAR DATASET
dir_path = "data/"
def importaData(files):
data = dir_path + files
allFiles = glob.glob('data/*.csv')
list_ = []
cols = ['ANO_BO', 'DATAOCORRENCIA', 'PERIDOOCORRENCIA', 'BAIRRO', 'CIDADE', 'LATITUDE', 'LONGITUDE', 'LOGRADOURO', \
'DESCRICAOLOCAL', 'DESCR_TIPO_VEICULO']
for file_ in allFiles:
df = pd.read_csv(file_,index_col=None, header=0, delimiter=';', usecols=cols)
list_.append(df)
df = pd.concat(list_, axis = 0, ignore_index = True)
return df
# IMPORTANDO DATASET
all_data = importaData('*.csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment