Questions tagged as 'pandas'

1
answer

Pandas: Create Multiple Columns in the DataFrame

I have a spreadsheet with the following information: NUM_LEGISLACAO DSC_URL ... COD_TIPO DSC_TIPO 0 323/1895 NaN ... 2.0 CONCRETO 1 2.269/1896 NaN ... 2.0 CONCRETO 2 2....
asked by 27.05.2018 / 00:23
1
answer

importing data extension ".data"

My Python code is loading an internet dataset, but it does not recognize the columnar number of the data. Python code: import pandas as pd ##Importando dados data = pd.read_table('https://archive.ics.uci.edu/ml/machine-learning-databases/a...
asked by 20.05.2018 / 17:19
1
answer

How to save averages from a dataframe, a new column containing the averages of this dataframe using pandas?

Good evening, I'm having a problem trying to save average values of a df, in a single column. An example of how I wanted it to be was: Dataframe Inthisfirstpart,Ijustopenedmydataframeandtranspiredtogetthemean()valueswiththemean()function...
asked by 22.05.2018 / 01:28
2
answers

Changing a value with the pandas library

I am opening a .csv file with the pandas library, however I am informed at the time of opening this file that a particular column presents values of different types. I know the character "/" was used in this file to denote missing data, this is...
asked by 11.02.2018 / 15:52
1
answer

Add column to a dataframe based on sorting done in another dataframe

Greetings! I have two dataframes. Both have columns that determine ranges, with maximum and minimum numbers. In each dataframe the ranking of each range is done one way. I wanted to make a new column in the second dataframe with the rating accor...
asked by 31.01.2018 / 01:52
1
answer

Cross valdation n-fold

W1 W2 W3 W4 A/N 0 0.543405 0.278369 0.424518 0.844776 1 1 0.121569 0.670749 0.825853 0.136707 1 2 0.891322 0.209202 0.185328 0.108377 1 3 0.978624 0.811683 0.171941 0.816225 0 4 0.431704...
asked by 31.10.2017 / 10:40
1
answer

How to round up value created in pandas?

Hello Please, in Python 3 pandas I am creating this dataframe with the sum of another dataset: total = cand_doacoes.groupby(['CPF_candidato', 'Nome_candidato', 'Cargo']).Valor.sum().reset_index() total = total[(total['Cargo'] == 'Deputado Fed...
asked by 11.10.2017 / 20:19
1
answer

MemoryError in pandas

Hello I am using the pandas merge command in python3: ibama_doadores_orig = pd.merge(eleitos_d_s_doadores, ibama, left_on='CPF_CNPJ_doador_originario_limpo', right_on='CPF_CNPJ_limpo') But a message of MemoryError appears: ---------------...
asked by 05.10.2017 / 14:24
1
answer

Transform columns into rows in a dataframe

I have a dataframe with columns: LUC Contrato Fantasia Ano Mes 01 02 03 05 ... 30 Tatividade I need to turn these columns with the days of the month into rows. In each column has the value sold that day by the store. It would have to look...
asked by 06.12.2017 / 02:03
1
answer

Sort Python Data Frame (Pandas) on two levels

I have this DataFrame and I want to organize it first by name and then by year, that is, sort it in two levels. How can I do this? Country Name Country Code Indicator Name Indicator Code Ano Pobreza 0 Aruba ABW Pop...
asked by 17.08.2017 / 22:39