Questions tagged as 'python'

1
answer

How to refer to a div that contains this tag? [BeautifulSoup4]

I am practicing web scrapping and I would like to know how to refer to the div element of the page that I am scrapping that contains the following property <div style="color:#000000; padding-left:55px; padding-bottom:1px; background image:u...
asked by 27.02.2018 / 04:44
1
answer

Date__range inclusive in Django

I'm trying to do the following filter in a Django query: ben_filtro = Auditoria.objects.filter(fecha__range=[fechaInicial,fechaFinal]) I get the results but excluding some that are in the final date. Fields are of type DateTimeField ....
asked by 23.02.2018 / 01:03
1
answer

Find values from a list in a csv by column Python

What I want to do is identify which site is missing a date from the list called dates. To be more clear I leave an example with data: fechas = ['1/1/2000','2/1/2000','3/1/2000','4/1/2000', '5/1/2000'] file: Sitio,Fecha,Importe a.com,1/1/2000...
asked by 19.02.2018 / 18:46
1
answer

Systems of differential equations

I'm doing the system of differential equations in Python but I do not understand how to make the solution appear. %matplotlib inline import matplotlib.pyplot as plt import sympy import numpy as np from scipy import integrate x = sympy.Sy...
asked by 18.02.2018 / 03:45
1
answer

SyntaxError: Generator expression must be parenthesized if not sole argument

I would like to combine a de-structuring with a python map to process pairs of columns in a data list. My ideal solution would be something like def openOrSenior(data): return list(map(lambda [age, handicap]: 'Senior' if (age>54 and ha...
asked by 02.03.2018 / 15:21
1
answer

'FileField' object has no attribute 'is_hidden' when creating form to upload documents

I get this error in the template that renders my view, in which I am testing the FileField field in the model. {% extends 'base.html' %} {% block Tilte %} Registrar Solictud a la Convocatoria {% endblock Tilte %} {% block navbar %} {% end...
asked by 01.03.2018 / 17:36
1
answer

Error unpacking data from file with struct.unpack, incorrect length of string bytes

I'm doing in Python a program that unpacks a series of data from a file stored line by line. As you can see, I'm using the struct module and the struct.unpack() function for that purpose. The data for each line is: 2 bytes, 2 32...
asked by 02.03.2018 / 17:39
1
answer

Event hover in pyqt5

I would like to know how I can generate a Hover event in the bclose button of the following code so that when the mouse is over it changes its color, for example: This is my code: import sys from PyQt5.QtWidgets import * from PyQt5.QtGui...
asked by 20.03.2018 / 05:10
2
answers

Exclude values from a python list

I am looking to do something similar to this, for each item of the array url minus the item index 0: url = ['a.com', 1, 2, 3, 4, 5, 6, 7] for item in url[0,1,2,3,4,5,6,7]: data ={ "adSize": {"id":'{}'.format(it...
asked by 14.02.2018 / 23:49
1
answer

How to add a matrix and headings to a DataFrame that already has an index

I have an array of results and I would like to put it in a DataFrame who already has an index with the following headings "one, two, three, four, five, six, seven" to be able to export it in csv format: [[ 9.98611569e-01 2.61135280e-01 9....
asked by 10.02.2018 / 16:09