Questions tagged as 'pandas'

1
answer

Creating a bar chart to compare data

I'm doing the udacity data science course. It's my first contact with programming, so do not judge the silly mistakes haha. I am comparing two data frames with 2008 and 2018 year car information. One of the questions asks to compare the impro...
asked by 31.03.2018 / 16:51
0
answers

Pandas DataFrame to_html or iterate over the data in the template?

I actually wanted to iterate over the data in the template? But how do I play my pivot data in context and treat them in the template? df = pd.DataFrame(data) pv = df.pivot(index='cands', columns='titles', values='grades') context['quizzes'...
asked by 04.10.2017 / 03:09
2
answers

How to keep the left zero in import in Python?

Hello I have several TXT files with CPF numbers. The CPF has 11 numbers, so you can have leading zeros to complete that size I opened these files in Excel and put them together into one. In the CPF column, before opening each file, I made the Ex...
asked by 23.10.2017 / 17:15
0
answers

Python Pandas CSV

I started learning Python a short time ago and I'm doing a project to normalize client data. But I do not know how to make a comparison of type: reads the CSV field the CP7, searches for all CP7 of the CSV CTT and writes in the table PN...
asked by 02.06.2017 / 16:25
1
answer

Pandas Conditional Sum

Hello. I have the following situation df1 = pd.DataFrame({'Key':['a','b','c','a','c','a','b','c'],'Value':[9.2,8.6,7.2,8.3,8.5,2.1,7.4,1.1]}) df2 = pd.DataFrame({'Key':['a','b','c']}) And I would like the following answer in [0]: df2 ou...
asked by 30.11.2016 / 11:41
1
answer

Creating data set to sklearn with dataframe pandas

I have the following situation from sklearn.linear_model import LogisticRegression import pandas as pd x = pd.DataFrame({'A':[1,3,8,6,1],'B':[2,6,9,3,2]}) y = pd.DataFrame({'C':[8,6,3,6,1]}) How do I make this happen? LogisticRegression(...
asked by 01.07.2016 / 19:02
1
answer

Replace words in a text that are formed, necessarily, formed of letters and numbers

I am trying to replace words in a text that are formed, necessarily, formed of letters and numbers. I've tried this: def passwords(): df['C'] = df['C'].str.replace(r'[a-zA-Z0-9]', '<password>') return df My data:...
asked by 06.12.2018 / 11:54
1
answer

Convert data frame pandas to array

I have a data that, from .txt, converted to a Dataframe (DF) with pandas. For the various activities that I realized it is very convenient that it be a DF. There is only one column with values besides the index. Now, I would like to...
asked by 03.09.2018 / 02:42
1
answer

Error creating column in dataset Pandas

Hello, I am creating a project in python using Pandas and I want to create a column whose values are the Closed - Open column, but an error occurs that I can not resolve. My code: import pandas as pd dataset = pd.read_csv(r'Documents\Pr...
asked by 21.03.2018 / 18:01
2
answers

Pandas can not find file

I'm using Pandas in Python to read a CSV file that is on my computer, but an error message appears, it does not seem to find the file: import pandas as pd reclamacoes = pd.read_csv("C:\Users\Reinaldo\Documents\Jornalismo_de_dados\Justica\r...
asked by 27.08.2017 / 21:46