Questions tagged as 'pandas'

1
answer

Adapt a dataframe to a range of dates

my doubt: I have a df (with Fecha as index and another column Cantidad ) with records every 3rd day from 2016-05-03 until 2016-05-20, example:    df.index [   2016-05-03,   2016-05-05,   2016-05-07 ...] With: df = df....
asked by 05.05.2017 / 18:16
1
answer

Save a series of Dataframes in a single python

I'm using a function that uses all the values of a column hosted in a file .csv The result of the function is another column with numeric values that is hosted in a previously created .csv file. To select the column I use ilo...
asked by 09.05.2017 / 00:46
0
answers

Improve the speed by creating dynamic columns in a Dataframe

I am creating a Dataframe with the following information: import numpy as np import pandas as pd from time import time start_time = time() columns = 60 Data = pd.DataFrame(np.random.randint(low=0, high=10, size=(700000, 3)), columns=['a', '...
asked by 08.10.2018 / 22:33
1
answer

Problem with pandas.DataFrame.cumsum function

I have the following dataframe in python: month = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,1,2,3,4] active = [1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1] data1 = [1709.1,3869.7,4230.4,4656.9,48566.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...
asked by 27.09.2018 / 17:14
1
answer

Save several DataFrames with a for loop in different sheets of the same excel file

I would appreciate your help, I have the following code: for embalse in ["PIL", "PUL", "VDV"]: vo = pd.read_csv('...\Desktop\pucv.xlsx',encoding='utf-8') vo=vo[vo["Embalse"]==embalse] writer = ExcelWriter('...\Desktop\embalses.xlsx...
asked by 11.09.2018 / 22:26
1
answer

How to change legends or names on x axis of boxplot pandas

I have created a dataframe with columns of temperatures per month. When I do boxplot with pandas, the name I put on the columns appears on the x-axis, but I want to change them in the figure. import numpy as np import matplotlib.pyplot as p...
asked by 23.08.2018 / 16:07
1
answer

Select intervals of a column in a DataFrame

I have a DataFrame made with pandas, formed by the columns ['x','y','z0','z','arbol'] , attached screen of its structure: From the data of that general DataFrame I have extracted all those whose tree value is equal to 1 creating a...
asked by 13.07.2018 / 11:03
1
answer

Replace values in a CSV Python

I'm lost with something. I have a csv file that I import with Pandas to be able to convert it into an Numpy array, and I have the following function to replace values in the original CSV file: # Cargamos el archivo en la variable data, com...
asked by 30.06.2018 / 18:45
0
answers

Updating the obsolete Pandas package pd.ewma () to pd.Dataframe.ewm ()

I had a code that averaged exponentially from the pandas pd.ewma () method --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipyth...
asked by 14.12.2018 / 15:04
0
answers

TypeError: list indices must be integers or slices, not list. Can you help me?

Here's the code import numpy from pandas import DataFrame, Series countries = ['Russian Fed', 'Norway', 'Canada', 'United States', 'Netherlands', 'Germany', 'Switzerland', 'Belarus', 'Austria', 'France', '...
asked by 01.05.2018 / 21:08