Questions tagged as 'pandas'

1
answer

Select rows by first digits, and average them by year

I have a CSV of the following type: code year sales 2011 1970 5000 2011 1971 5200 2011 1972 ... ... 2015 1970 2015 1971 2015 1972 ... 3025 ... 3026 ... 3052 ... How can I select all the code lines starting with '2...
asked by 10.11.2018 / 02:10
0
answers

Code runs in Jupyter and VSC of error

IrunthiscodebyJupyteranditrunsnormally,butwhenItrytorunthissamecodeinVisualStudioCodeitgivesthefollowingerror:"File b'Salaries.csv 'does not exist" says that the file does not exist, but there is sim . import pandas as pd import numpy as np...
asked by 06.11.2018 / 12:03
0
answers

Bag of words in Python

I have a news dataset and want to separate them between two classes. For this I thought of using Bag of words, but I'm not getting with Sklearn. I've tried the following: #Bag of words from sklearn.feature_extraction.text import CountVectorize...
asked by 31.10.2018 / 02:01
2
answers

Difference between tables, criteria

I have two tables as follows: I want to get the data that is in the left table and that is not in the right one. As the two tables have a common field, CPF, I want to generate another table only with the CPFs that are in the table on the left bu...
asked by 24.10.2018 / 20:41
1
answer

Pandas DataFrame.loc () does not find the record

Good morning! I'm trying to manipulate a DataFrame that originates in a DRE (accounting) report. I would like the index to be the account code, which I have already been able to do. However, DataFrame.loc [] does not find the record. Followin...
asked by 25.10.2018 / 16:30
1
answer

.txt file parsing using Pandas from external rules in a JSON

I have a dataset in .txt format that has its own formatting with the rules described by a separate JSON file itself. Is there any direct way to tell Pandas to use this JSON as the basis for decoding .txt? This is a piece of the .json file...
asked by 16.10.2018 / 20:37
0
answers

How to do the equivalent of the calculated field of Excel in a pivot_table pandas (Python)?

I want to divide the revenue by volume into a pivot_table (such as a calculated Excel field), so that the average price per product of each month appears: The code you'd like to do is more or less like this: df.pivot_table (index= "Produt...
asked by 27.09.2018 / 16:27
0
answers

Subtotal in Columns - Pivot Table - Pandas

I'm trying to create a pivot table that has, besides the general total, a subtotal between column levels and lines as well. The lines I've already achieved through the following function: table = df_consulta.pivot_table(index=["CAT1","CAT2...
asked by 10.09.2018 / 17:29
1
answer

Change column data using Pandas

I'm trying to learn panda but I have a question here I have the following data: PSG CLASS AAA 1 BBB 2 CCC 3 DDD 1 I wanted to create a new column, using Pandas, with the name of Class and with the information of...
asked by 09.08.2018 / 21:01
1
answer

Group Data by Month / Year

import numpy as np import pandas as pd BASE_GERAL = pd.read_csv('base_prestadores.csv') indice | data_utilização| preço | quantidade_itens 1 | 2014-05-01 | 20.00 | 5 2 | 2014-05-08 | 30.00 | 6 3 | 2014-04-10...
asked by 26.07.2018 / 20:57