Questions tagged as 'pandas'

1
answer

Problem when creating Dataframe in Pandas using Python 3.x

I have several lists and I want to create only one Dataframe to export later. The lists are of the type: a=[1, 2, 3, 4, 5, 6, 7, 8] b=[9, 10, 11, 12, 13, 14, 15, 16] For this I am creating 2 dataframes in the following way:...
asked by 09.08.2017 / 00:31
1
answer

TypeError: 'int' object has no attribute '__getitem__'

I have a data frame with different identification numbers and I am trying to format it in two sections, if it has more than 10 digits the format is: 123.456.789-0, if it is different to 10 digits (less or more) the format is : 123,456,789 / 123,...
asked by 20.10.2018 / 01:25
1
answer

Show all combinations by multiplying all the numbers in a matrix

Particles of a matrix of three columns and an indefinite number of rows.The numbers of the first and second row can be any number, and the third column is always a column of 1. Let's say that the number of rows is 5, and we have for example the...
asked by 23.09.2018 / 18:37
1
answer

type 'exceptions.ValueError': invalid literal for int () with base 10: '19065171.'

I have the following code: for i in range(0, len(terceros_df.NIT)): print 'esto es i =', i number = terceros_df.iloc[i]['NIT'] length = len(str(number)) if length == 10: str_number = str(number) nit = str_number...
asked by 22.10.2018 / 17:30
1
answer

Convert timestamp to dd / mm / yyyy and add Timezone to Dataframe Panda

I am loading information into a DataFrame of the Python Panda module, where I have a timestamp type record, that information is brought from MongoDb cursor = collection.find( { "sono" : str(sono), "time" : { "$gt" : int(start) }, "time" :{"$l...
asked by 16.08.2018 / 21:36
1
answer

Only detect a column when loading csv

I have my historical series downloaded in a csv file, which has 5 columns    ['Date', 'Price', 'Open', 'High', 'Low'] I do the following: import pandas as pd df = pd.read_csv("C:/Users/Lazardi/Desktop/GFG.BA.csv", header=0,index_col=Fal...
asked by 02.06.2018 / 19:11
1
answer

pandas python data management

I have a Dataframe with cities from io import StringIO import pandas as pd csv =StringIO(u'''\ city bogota manzanares guapi el paso momil valencia beltran Lima ''') and I want you to look for a list of the department that corresponds to th...
asked by 08.05.2018 / 22:10
1
answer

Count number of repetitions in pairs using pandas

A question recently , that did not specify with what language / technology I wanted to solve it, it impelled me to think how I would do it with Pandas. The question can be rephrased in the Pandas context as follows. Given a dataframe suc...
asked by 11.05.2018 / 17:17
1
answer

Copy data and formats of an excel sheet python

I have the following problem, when I want to copy the data of an excel sheet and besides its formats, I only copy the data. import pandas as pd template = pd.read_excel('Template_sugerencia.xlsx', sheet_name='template') writer = pd.ExcelWrite...
asked by 16.02.2018 / 21:26
1
answer

In python 3 and Pandas, how to add data from a dictionary to a dataFrame, only if they do not exist?

In my Python script I have generated a dictionary with several data, which I want to add to a CSV file, only if the dictionary keys do not exist inside the file, or if they exist then they are overwritten so they do not duplicate . How can I...
asked by 31.01.2018 / 21:45