Questions tagged as 'pandas'

1
answer

Pandas: How to merge two data frames?

Good morning everyone! I am counting on your help again. I have 2 CSV, as below: # f1.csv num ano 76971 1975 76969 1975 76968 1975 76966 1975 76964 1975 76963 1975 76960 1975 and # f2.csv num ano dou url 76971 1975 p1...
asked by 17.11.2018 / 11:41
1
answer

groupby - add according to criteria

I intend to add all the earnings of an official, for his cpf, but only when he earns 100, disregarding other values. I'm using this code, but it's not right: aip.groupby(['CPF']).sum() where(aip['Valor']==100) By taking the sum column, whic...
asked by 11.11.2018 / 14:13
1
answer

Pandas iterrows, how to do the second looping using the index

for index, row in candles.iterrows(): if (row['Twintower'] == 1): I would like to do a second looping from the moment he finds this condition, ie from this index down, or row down, I tried several options TypeError...
asked by 22.12.2018 / 22:55
2
answers

Error in indexing when separating line information

import pandas as pd import numpy as np import matplotlib as plt df = pd.read_csv('dito_julho.csv') df.head() campanha valor 1 Prospect | 5 dias | Com crédito 2 2 Prospect | 5...
asked by 10.08.2018 / 21:55
1
answer

Select values from a column from other columns

I'm trying to select only the values from the flightID column where DepDelay and ArrDelay I tried this: delay = data.loc[(data['ArrDelay'] > 15) & (data['DepDelay'] > 15), ['FlightID']] But it did not work ... KeyError...
asked by 09.10.2018 / 17:33
1
answer

Assign day time to hours

I have the following df: df = pd.DataFrame({'hora completa':['21:35:00', '22:16:00', '00:50:00', '09:30:00', '14:30:00']}) print(df) hora completa 0 21:35:00 1 22:16:00 2 00:50:00 3 09:30:00 4 14:30:00 I need to...
asked by 14.06.2018 / 05:59
1
answer

Filter lines on pandas by a list

Given the dataframe below, I'd like to filter the row data based on the 'Filterlist' list. nome valor 0 foo 2 1 bar 3 2 fiz 2 3 zaz 5 4 foo 6 5 far 7 6 bar 2 7 fiz 9 8 zoo 6 9 boo...
asked by 22.06.2018 / 15:52
1
answer

Save Excel file in Python through Scrapy

How do I make my spider save in a single XML file all the Excel data from the links that I extract? Or do you also save in each single XLS file in the project folder? Part of my spider: def parse(self, response): divs = response.xpa...
asked by 14.05.2018 / 20:53
1
answer

Convert monetary value (string) to Python / Pandas float

I'm reading a csv file where one of the columns has monetary values of '10, 000.00 ', the pandas is interpreting as a string. I wonder if I have to convert this into a race (iterating all the items in the column) or is there an easier way to...
asked by 03.05.2018 / 22:07
2
answers

How to invert a column in Python?

I would like to know how to flip the "Name, Last, Age" to "Age, First, Last" Followmycode:importpandasaspd#Importaabiblioteca"Python Data Analysis" df = pd.read_excel('Pasta1.xlsx') #Lê o arquivo xlsx df = df.drop('MiddleInitial', axis = 1) #...
asked by 17.04.2018 / 23:58