Questions tagged as 'python'

1
answer

Know if a row of a dataframe has a NaN value - Pandas

I am trying to learn and get loose with pandas (which is costing me). I have a dataframe similar to this one: If I want to know if there is any NaN, None or NaT value in the set I apply the following code. t = df.isnull().any().any()...
asked by 10.12.2018 / 20:52
1
answer

Kivy: Load a text from a file in a label

I want to load a text from a file in a label. My code in python is: # config from kivy.config import Config Config.set('kivy', 'keyboard_mode', 'system') from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.lang import...
asked by 16.04.2017 / 21:55
1
answer

kivy: change the color of a label

is the following code in python: # config from kivy.config import Config Config.set('kivy', 'keyboard_mode', 'system') from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.lang import Builder Builder.load_file('design....
asked by 18.04.2017 / 06:27
1
answer

How to configure Frame widget in Tkinter?

I've been learning to create Gui in Python with Tkinter for almost a week. When creating free space around or creating a box and determining the measures of the widget by using the Frame container, you can not modify the attributes such a...
asked by 15.04.2017 / 05:19
1
answer

how to get 'id' from a foreign key

Good what I want to do is fill a table that has a foreingkey and not take the value that saves id in the base data class Reportes(models.Model): id_fichero=models.ForeignKey(Cargar_Fichero) # file=models.FileField(null=True)...
asked by 27.04.2016 / 00:19
1
answer

Round decimal up in Python

I have a decimal number of 1.1 or 1.2 or 1.6 or 1.9 what I want is to approximate any of these numbers to 2. I mean I have a 1.1. How do I approach 2? By means of int() all approaches to 1, the same if I have 3.4 or a 3.1 or 3.8 approa...
asked by 26.04.2016 / 18:14
2
answers

I can not solve the error: TypeError: Object of type method-wrapper is not JSON serializable

# Import(s) # import json from chat import message_handler as me import random ############# mind = {"message": "null","mID": 0,"reply": "null"} def learn(m): getMessage = m getReply = me.reply strReply = getReply.__str__ min...
asked by 17.11.2018 / 22:37
1
answer

I want to write to a file without replacing the text with a "dict" without the "" of the string

mind = {"message": "null", "mID": "0", "reply": "null"} mind["mID"] = random.randint(0,1000000000000) mind["message"] = getMessage mind["reply"] = strReply Assuming a hypothetical operation only, you would want to get that by calling the...
asked by 18.11.2018 / 00:49
1
answer

Restart in cycle for

I am doing a program which reads a file (which contains in lines words, is attached) and has to return a new file with the word in question and the sum of its characters (these I generated from a dictionary ). The problem is that it does everyth...
asked by 19.11.2018 / 20:51
1
answer

how can I substitute a date using compile_obj.subn?

I do this for fich in ficheros: coincidencias = re.search(patron, fich) #print(coincidencias) if coincidencias: print("coincide ----------------------->"+fich) Result C...
asked by 22.11.2018 / 14:10