Questions tagged as 'python'

1
answer

How to add elements in a .csv file in python

I'm having a hard time creating an algorithm that adds a third-row element to the CSV file in the Python language. The file has the following data: Serial; Imei; Número; Icc; Stock 869606020314526; 8...
asked by 09.08.2018 / 20:19
1
answer

Change column data using Pandas

I'm trying to learn panda but I have a question here I have the following data: PSG CLASS AAA 1 BBB 2 CCC 3 DDD 1 I wanted to create a new column, using Pandas, with the name of Class and with the information of...
asked by 09.08.2018 / 21:01
2
answers

Sum of column totals

I own this dataset: I would like to create command to sum the values of each year, and put in a list. lista=[] for i in range(2008, 2041): area[i].sum() lista.append(i) More did not work the way I did, I would like some help....
asked by 09.08.2018 / 13:57
0
answers

How to sum values from a request:

Example: request = requests.get('https://api.amountofsomething.com') quantidade = requisição.json()['amount'] This request returns the quantity, for example: {[{25}{120}{158}{0}{2}{10}]} I need to add values without patterns. I tr...
asked by 09.08.2018 / 05:06
0
answers

How to process data without the kernel die?

I want to process the data in a unsupervised.py file. However, every time I start, my computer almost freezes and it looks like the kernel dies. It seems to be generated because of a memory management error. In particular, it is when I execute...
asked by 11.08.2018 / 12:48
1
answer

NameError: is not defined in python3

I have a simple problem, when I execute this function it returns an error:    Traceback (most recent call last):     file.py3 on line?, in getUserOutputs       userOutput = _runwwmdh (testInputs [i])     file.py3 on line 15, in _runwwmdh     ...
asked by 15.08.2018 / 01:42
0
answers

Guess Game Python Tkinter

I created a code in Python to present a game of advection, numbers between 1 and 100. I wanted to implement this game in a graphical interface, using the Tkinter module. I had an idea, I created a code using tkinter, but after that I crashed. My...
asked by 07.08.2018 / 23:36
1
answer

File corrupts when trying to copy it [closed]

I was trying to copy a file using Python, but the file corrupts ... Look at the code: #!/usr/bin/env python cf = raw_input("File: ") ds = raw_input("Destino: ") with open(cf,"rb") as fl: for l in fl.read(): l.rstrip() with open(ds,"wb")...
asked by 16.08.2018 / 17:08
1
answer

Python IndexError: list index out of range

I downloaded this Python code here: # -*- coding: utf-8 -*- from sys import exit from json import loads from Tkinter import * from time import sleep from math import floor from random import randint from itertools import izip from urllib2 impo...
asked by 16.08.2018 / 13:55
0
answers

Compare files in two directories and copy duplicates into a third directory - python

I have the following situation: A directory with more than 3,000 files .jpg of which were copied half of the files to another directory, but after a problem in the computer the copied files were corrupted. Then I created a code to acce...
asked by 17.08.2018 / 15:05