Questions tagged as 'pandas'

1
answer

Convert Days and Time (Hours x Minutes x Seconds) to Time Only

I have a Dataframe where I'm making the difference between two different dates to get the difference in Hours and Minutes, for example: data_inicial = '2018-07-03 16:03:00' data_final = '2018-07-05 00:00:00' duracao = data_final - da...
asked by 05.07.2018 / 18:53
2
answers

Group per week

I have a table like this I am trying to separate by week, I do not have much knowledge in which functions I can use to check how many weeks have between those dates, to later group. The data is in a csv table, I am using pandas to open the csv f...
asked by 19.08.2017 / 14:05
2
answers

Add a new value at the beginning of a pandas series

How do I add a new value to a pandas series? I made the copy of the dataframe series and now I need to add a new value to the swap_hoje series, however, instead of being at the end of the series, I need it to be at the beginning, at...
asked by 21.06.2017 / 18:51
1
answer

Grouping and aggregating data

I have the following file in CSV ( 12 Millions of records): UF Municipio Cod NIS Valor Data MA IMPERATRIZ 803 16361947271 45.00 01/01/2011 MA IMPERATRIZ 803 74629273937 15.00 01/01/2011 BA RUY BARBOSA 3845 16481166579 5...
asked by 18.05.2016 / 00:47
1
answer

Python - invalid literal for float ()

I have an array that looks like this training_set = [['03/11/2017' '16,94'] ['01/11/2017' '16,90'] ['31/10/2017' '16,77'] ... However, I can not manipulate the numbers because they are in the form of string . How do I clean the data and...
asked by 07.11.2017 / 02:17
1
answer

Return in a DataFrame - Python

Good afternoon. I have a question regarding Python. I have an if where has the conditional and else, the else it processes more than one file and I need to save all the information it reads inside a DataFrame, is there a way to do this? The c...
asked by 22.05.2018 / 20:43
1
answer

How to change column type in pandas?

Please in Python 3 and Pandas, I want to change the type of a column from a CSV file. I used this command: cand_doacoes ['CPF_CNPJ_doador'] = cand_doacoes.CPF_CNPJ_doador.astype (int64) But the error appears: NameError Traceback (most r...
asked by 04.10.2017 / 15:40
1
answer

Mounting table from a csv, grouped per week, with python and pandas

I'm using pandas and I open the following table using the code tst = pd.read_csv('Iteracao.csv',delimiter=",") I'mtryingtogroupasfollows,whereweek1istheweekofthedate2017-02-10/2017-02-16,followingthelogicfortheotherweek,theindexdoesnothave...
asked by 20.08.2017 / 04:16
1
answer

Importing data using pandas in python

Good afternoon, guys! I'm trying to import a csv file using the Pandas package in Python import pandas as pd names_col = ['AnoInfracao', 'TrimestreInfracao', 'CodigoInfracao', 'DescricaoAbreviadaInfracao', 'Gravidade', 'DescricaoTipoVeiculo...
asked by 13.12.2016 / 19:10
1
answer

Scalar product

Objective: To make a neuron using the load of weights and inputs from an xlsx The scalar product was calculated in several ways as an exercise, but when I try to use the dot it gives an error. the input: Home page -1,00 7,00 5.00 t...
asked by 22.09.2018 / 07:01