Questions tagged as 'pandas'

3
answers

How to iterate in a dataframe for a certain number of rows?

I have the following dataframe: import pandas as pd import numpy as np data = pd.date_range('20180101', periods=300) df = pd.DataFrame(np.random.randn(300, 5), index=data, columns=['open', 'high', 'low', 'close', 'volume']) I...
asked by 27.12.2018 / 14:54
1
answer

Problem with pandas.DataFrame.shift function

I have the following dataframe in python: months = [1,2,3,4,5,6,7,8,9,10,11,12] data1 = [100,200,300,400,500,600,700,800,900,1000,1100,1200] df = pd.DataFrame({ 'month' : months, 'd1' : data1,...
asked by 27.09.2018 / 01:18
1
answer

Transform dataframe dictionary into a single DataFrame

I have a dictionary that has Pandas dataframes as values. I want to get a new DataFrame joining all the dataframes contained in the dictionary. The problem is that I need to create a new column in which each row has the value of the key o...
asked by 06.07.2017 / 11:50
1
answer

Create column from another column in which each row indicates the column to use to obtain that cell

I have the following information in a DataFrame in Python: ## x1 x2 x3 x4 x5 colum ##0 206 214 021 122 554 2 ##1 226 234 123 456 789 4 ##2 245 253 558 855 123 5 ##3 265 272 000 111 222 4 ##4 28...
asked by 12.09.2018 / 12:36
1
answer

Python collation excel report with Pandas

I am generating a report with the Pandas module in Python, I get the data from MySQL, but there is a column with accented data, at the time of generating the report it falls, I leave information related to the problem. Connection code: con...
asked by 11.05.2018 / 14:21
2
answers

Extract cell data using pandas

I have a table in csv format with more than 30 columns with values of 0 per row, but some columns have values. Then I would like to use Pandas to extract those values and store them by Zone # Area # and Ptc # and store the values according to th...
asked by 23.06.2018 / 17:17
1
answer

How to load a large volume of data with Django Querysets?

I have a loading process in a Django project which from an excel file stores information in a Business model. My loading process works, the problem is that the execution time is too high due to the data volume of the excel input. Model.py...
asked by 14.05.2018 / 17:29
2
answers

Change date format ymd_hms to ymd

I have a dataframe in Python with two columns: StartTime and StopTime . In one of the operations, I need to group the data per day ( StartTime ). For this I need to eliminate hours, minutes, seconds from that col...
asked by 22.06.2017 / 12:45
1
answer

Graph with Python, Pandas

I have to graph from a csv file similar to this: Cedula,Genero,Placa,Tipo,Multa,Fecha 0931921407,Femenino,GYS-9575,Automovil,Grave,2016-06-13 0910703362,Masculino,GSF-7654,Automovil,Leve,2016-02-18 0931921408,Femenino,GOI-3298,Automovil,Muy gr...
asked by 23.08.2016 / 02:45
3
answers

Do operations on columns in a Dataframe loop

I want to do calculations on three columns of an array values_array . def calculateAllEMA(self,values_array): df = pd.DataFrame(values_array, columns=['BTC', 'ETH', 'DASH']) for i,column in enumerate(df[column]): ema=[]...
asked by 11.08.2017 / 18:01