Questions tagged as 'pandas'

0
answers

how to use plt.xticks () to show dates (in days) in python?

I have the problem that I put the date on the x axis but it only gets in one part like the image together all day to the left the data is for the whole year and I want it to show days or months   plt.title("sacramento") plt.xlabel("crime...
asked by 23.08.2017 / 20:38
2
answers

how to calculate time difference between two clients

How can I calculate the time difference between a client's actions? I want to calculate all the elapsed time of the users until it passes to the next user. example .... from user 1 to two it was 2 days 4 hours, 5 seconds. This is the dataf...
asked by 22.11.2018 / 20:25
2
answers

Formatting pyramid panda dataframe

I have a set of business tax identification data. from io import StringIO import pandas as pd csv =StringIO(u'''\ NIT, TYPE 8600219985, company 9001899451, company 19479647, person 19065171, company 79896134, person 87111760819, person ''')...
asked by 10.05.2018 / 21:46
2
answers

Group consecutive duplicates in python

I am wanting to do a grouping of rows in a dataframe, but only of the consecutive ones. To put it more clearly, I give an example: ip_src ip_dst packet_length src_port dst_port comm_type 0 192.168.0.7 52.31.84.22 28...
asked by 15.05.2018 / 05:13
2
answers

Error when trying to compare dates of two time series: Can not compare type 'Timestamp' with type 'str' "

I'm doing a data transformation and I need to run a while between date periods, but I have the error:    "TypeError: Can not compare type 'Timestamp' with type 'str'" I have seen with type() what type of data they are and bo...
asked by 14.12.2017 / 20:38
2
answers

Print certain pandas rows

I have a dataframe similar to the following: I want to show those columns that any of their rows contain a NaN, NaT or None. If I apply the following code I see what they are: def null(x): return any(pd.isnull(x)) print df.appl...
asked by 09.12.2018 / 19:39
1
answer

Add rows by pandas names

I'm working with a data framework like this, but bigger and with more areas. I'm trying to add the value of the rows by their names. This is my code but I get an error. The total of the sums of the R or C zones go in the column total and...
asked by 05.07.2018 / 14:38
2
answers

Python Groupby pandas sums of strings and floating

I am trying to unify certain columns of my csv with pandas. The problem is that I want to add the values of Imp and Rev but the Categories I want them to come together and look something like this: sitio_id;url;Imp;Rev;Categorias http://url.co...
asked by 16.05.2018 / 20:37
1
answer

Compare the name of the fields of a dataframe in python with pandas

import pandas as pd main_file_path = '../input/train.csv' df1 = pd.read_csv(main_file_path) main_file_path2 = '../input/test.csv' df2 = pd.read_csv(main_file_path2) df1.columns df2.columns How can I know the fields they have in common and th...
asked by 21.03.2018 / 21:28
1
answer

Show only repeated elements with Pandas

Suppose I have a list in .csv with different columns, one of them is "teacher name", the second "subject" and the third is "year". There may be something similar to this: Nombre profesor Asignatura Año Juan Mates 2002...
asked by 15.11.2018 / 23:56