Questions tagged as 'python-3.x'

1
answer

Pandas: How to merge two data frames?

Good morning everyone! I am counting on your help again. I have 2 CSV, as below: # f1.csv num ano 76971 1975 76969 1975 76968 1975 76966 1975 76964 1975 76963 1975 76960 1975 and # f2.csv num ano dou url 76971 1975 p1...
asked by 17.11.2018 / 11:41
1
answer

How to relate a model to another model in Django 2

I'm doing a system in which I need to show data that is registered in another Model, which in this case is the Category field that is in Model Items and in showing them, the user would select one of them and the system would show the data that a...
asked by 13.11.2018 / 08:25
1
answer

How to save an xml string in a document?

I want to save my xml which is a str (return of an API) in an .xml file, but when I do this it does not work, could anyone help me? from xml.dom import minidom cont = minidom.parseString(xml) arquivo = open(local_save, 'wb') cont.writexml(arqu...
asked by 12.11.2018 / 19:44
1
answer

output function giving error syntax

lista1 = [1,2,3,1,1] lista2 = [2,2,3,1,3] res = list(input("Digite seus inteiros")) def exibiçao(lista1,lista2,res): print("{} {} {} {} {}".format(lista1[4],lista1[3],lista1[2],lista1[1],lista1[0] )) print("{} {} {} {} {}".format(lista2[4],lista...
asked by 02.11.2018 / 14:33
1
answer

Save Json dictionary in txt

How can I save one. dictionary json from a requests in txt. I tried to do this way more did not work. import requests import json url = requests. get("https://search.ams.usda.gov/farmersmarkets/v1/data.svc/zipSearch?zip=46201") response = jso...
asked by 08.11.2018 / 03:57
1
answer

How do I show an image according to given Number being this number is by random in python?

import numpy as np import matplotlib.pyplot as plt from PIL import Image import cv2 def showfig(image, ucmap): imgplot=plt.imshow(image, ucmap) img0 = cv2.imread("zero.jpg",0) img1 = cv2.imread("um.jpg",0) from random import randint #gera...
asked by 30.10.2018 / 22:32
1
answer

How to create a function in python to connect the sql server?

To summarize the connection process, I'm trying to create a function to connect the database, but I'm not able to make the connection as expected: def conectar_com_banco(usuario): if usuario in 'illuminati': username = 'illuminati'...
asked by 30.11.2018 / 18:37
1
answer

Doubt how to shave data like Python using BeautifulSoup Table

I'm a beginner and I'm trying to get a table from the transparency portal site, but I'm not able to get the tag with no data at all. When I open the developer tool I visualize the data that I want the states and the transfer value to be, but w...
asked by 10.11.2018 / 10:18
1
answer

How to reverse the association of one file to open with another, in Pycharm

I got a song I copied and pasted on pycharm. The song was not recognized, appearing the option Associate with file type, when I clicked I linked the program to youtrack query, how do I revert as I was before?     
asked by 22.10.2018 / 23:19
1
answer

ADD Column - Django

How can I add a column to a table in the database using django? I tried the following migration and did not update my table: from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('api'...
asked by 18.10.2018 / 15:29