Questions tagged as 'python'

1
answer

Sockets with Java (server) and Python (client) without flush in python

Hi, I have a socket project (practice for now) and the problem is that on the client side (in python) I do not know how to clean or simulate the output buffer of the socket. The first message is sent "correctly", since it is the first and there...
asked by 07.07.2017 / 23:20
1
answer

psycopg2.OperationalError: fe_sendauth: no password supplied⁠?

It turns out that I'm trying to get my program to get data from a database generated from pgadmin, but I'm not making it happen. I'm trying to make this work: from psycopg2 import connect import dbconfig cfg=dbconfig dbname=cfg.dbname dbhos...
asked by 07.07.2017 / 22:01
1
answer

Parsing NLP with external list

Having an input text that will pass through the grammar and the output must be all the entries that the grammar finds in the text. The problem is that my non-terminals are external list files and I can not find a way to do it. Example of a p...
asked by 31.08.2017 / 17:22
1
answer

How to categorize a dataframe with python

I am using python and pandas to sort a dataframe that I have catogorized using a column with Boolean data like the following: df: X Y PROB 2 4 False 3 5 False 3 2 False 4 4 True 3 7 True 2 4 False 2...
asked by 31.08.2017 / 21:32
1
answer

How to use the matplotlib library

Good afternoon, I have to make a program that reads a .csv file with the following format:    15,10,10,15,20,25,25   20,20,10,10, -25,25,10 and generate the graph of audiogram . I have the following code: import matplotlib.pyplot a...
asked by 12.06.2017 / 23:46
1
answer

Write documentation of a library in a txt

The idea is basically to pass all the documentation to a txt import socket archivo=('sockets.txt','w') archivo.write(help(socket)) archivo.close()     
asked by 21.06.2017 / 00:45
1
answer

how to split a very long string in python

Hi, I want to split a very long string, it will look like this: "numerodecaracter1" &_ "numerodecaracter2" .. etc.. Try this import re s = "This is a long string that is holding more than 80 characters and thus should be split int...
asked by 03.06.2017 / 03:01
1
answer

Extract 2 satellite image files in a list within ".tar.gz"

I have a list of Landsat satellite images. Within the tar.gz file are the bands ex: File " LC08018051fecha.tar.gz " Contains:    LC08_fecha_band1.tif   LC08_fecha_band2.tif   LC08_fecha_band3.tif   LC08_fecha_band4.tif   LC08_fecha_ba...
asked by 08.06.2017 / 17:44
1
answer

How to fill the columns of a matrix A that are in a matrix B and missing in A?

I have two matrices P and Q and I want to do a matrix calculation P*Q.T . Then I need the same number of columns. P have m_p subscriber and n_p hashtags and m_q with m_p advertisements (which we call "eclipse") per...
asked by 07.06.2017 / 15:59
1
answer

How to create an array of "x" decimal numbers between the values "y" and "z"?

I want to obtain an array of decimal numbers between two values, (for example 2000.00 and 2100.00). I do not know how to do it: At the moment I have two alternatives, they never give me what I want: import numpy as np import random import deci...
asked by 28.05.2017 / 17:38