We’re rewarding the question askers & reputations are being recalculated! Read more.

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
0answers
7 views

clustering in k-menas and how to use legend

I`m doing clustering for 27 houses that are consuming electricity for 2 years and I used the legend function to give a color to each house but what is happening is each cluster has a color and they r ...
0
votes
1answer
21 views

Can you input two range values in same variable?

I had a question can i add two range values in same variable like for example A = range(int(input("Enter the range:"))) Will python allow me to input starting point and ending point of range?
-2
votes
0answers
11 views

Multi tasking. Taking 5 positions

I've got five position. I've to pass one position to function and do some task for 10 sec. Then that function should take another position and do task for 10 sec and so on. So how should i do it?
0
votes
1answer
23 views

Pivoting a Pandas Dataframe containing strings - add the columns in the first time one only and other wise it add values in any column

good morning all i have many files with the following format but with different values in measure column subject_id hour measure value 2 1 heart rate 40 4 ...
-2
votes
0answers
21 views

Syntax error : speak(f“You have{len(events)} events on this day.”) [duplicate]

This is my code , def get_events(day, service): #call the calender api date = datetime.datetime.combine(day, datetime.datetime.min.time()) end_date = datetime.datetime.combine(day, ...
-1
votes
1answer
20 views

Using command “ls -t | tail -n +4 | xargs rm --” to remove files in another location

I have RaspBerry Pi project where A/D converter collects 5 minutes long data files into data folder and all data except newest one will be removed in every hour by dataFlush.py script and crontab. The ...
-2
votes
0answers
20 views

Find index of first occurence of repetative number [duplicate]

Input: a=[0,0,0,0,0,1,2,3,4,0,1,2,0,0,0,0,0,1,0,0] Output: index 0,9,12,18 Input is list of numbers and output is index of first occurence of '0'
-1
votes
0answers
11 views

Digital voice into analog voice

I have been reading about how to convert a sound into a digital form, by identifying the sampling rate and the sample size in bits. I am in the process of having already digital NON-voice executables, ...
0
votes
1answer
36 views

How to access Boolean expressions using pandas

Below is Excel. Explanation : I have to delete CATEGORY, SUB_CATEGORY and SUB_CATEGORY_2 data if Filter column has > 0 value (Should remove NAN, 0 and negative values) Expected output: Below is the ...
0
votes
2answers
54 views

Rewriting function do display complex dictionary to be recursive ( more universal ) in python

Imput for functions is a complex dictionary: [{'blacklist': [{'devnode': '"^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"'}, {'devnode': '"^hd[a-z][[0-9]*]"'}, {'devnode': '"^cciss!c[0-9]d[0-9]*"'}]}, {'...
0
votes
0answers
33 views

How to check missing values in dataframe for specific datatype?

df1: Name marks class Avg is_stud Date 0 Tom 91.55 classA 45.0 True 10/2/2011 1 Jack 98.66 classB 65.0 False 11/2/2011 2 nick NaN classC NaN ...
-1
votes
0answers
38 views

How to make python script that reads one file and compares him with many files

I have situation where i need to translate 2400 files of text from one directory, lets call it dir1. Files are looking like this: language 1 = language 2(translate). On the other side in another ...
-1
votes
1answer
39 views

Im very unfamiliar with python 2.7. Im not sure how to convert a specific piece of code from 2.7 to 3+ [duplicate]

I have no idea how python 2.7 works. Is there a way for me to convert it to python 3? recipients = ['[email protected]', '[email protected]'] sent = 1 print 'Email sent to: %s (%s)' % (", ".join(...
0
votes
1answer
20 views

How to fetch hourly data of particular date through sql query using for loop by passing python list as an argument or parameter to that sql query?

I wanted to fetch a very large amount of one day data through sql database table using python but it was taking a very long time. So I've decided to fetch partly data, do some operation and append the ...
-4
votes
0answers
37 views

create a reminder for every 30 days billing or subscribing code in pyhton [on hold]

How to make a python code to creating a reminder for every 30 days billing or subscribing.enter code herei dont try anything because i dont know exactly what do to check?.
0
votes
3answers
92 views
+50

How to find all the JavaScript requests made from my browser when I'm accessing a site

I want to scrap the contents of LinkedIn using requests and bs4 but I'm facing a problem with the JavaScript that is loading the page after I sign in(I don't get the home page directly), I don't ...
0
votes
1answer
70 views

Avoid for loop? [duplicate]

Is there a way to avoid this for loop in favor of efficiency? I was thinking about iter/next functions but they don't seem to work properly.. def foo(): lst = [['a', 'b', 'c', 'd'], ['d', 'e', 'f'...
1
vote
0answers
11 views

When I implement FCNs using MITSceneParsing data, I got this error [TypeError: 'NoneType' object is not subscriptable]

I used MITSceneParsing data when I implement Fully Convolutional Networks. But I got this error [TypeError: 'NoneType' object is not subscriptable]. So anybody knows this reason? import pickle def ...
0
votes
0answers
14 views

How to print continuously data from telnet with telnetlib (python 3.7)

I want to print continuously data (real time) from telnet with telnetlib (python 3.7) but no resalt becouse the fonction read_all don't stop import telnetlib tn = telnetlib.Telnet('10.205.61.60', ...
0
votes
0answers
11 views

Create egg file without python distribution suffixed?

When I run python setup.py, it automatically appends the python distribution at the end and while distribution, makes users think, it only compatible with Python2 while the egg file is compatible with ...
0
votes
1answer
18 views

Scrapy: Can't create object of a class having *arg and **kwarg in init

In my scrapy spider I need to create object of another spider. class SpiderA(SomeSpider): def __init__(self, *arg, **kwargs): super(SpiderA, self).__init__(*arg, **kwargs) I need to ...
0
votes
2answers
33 views

How to receive tuple as an argument to a function in python 3?

I have some code that was working fine in python2. I need to translate it to python3. There is one piece of it that I can't understand how to adapt. Here is some code. Function with error def gauss(...
1
vote
2answers
40 views

How to rearrange values in a “set”? Python [duplicate]

I would like to place 'y' value at the end of the set {'e', 'y', 'u'}. I have tried to remove the value and then add it again at the end: last_vowels = 'y' vowels = {'e', 'y', 'u'} vowels.remove(...
0
votes
3answers
44 views

How to check constraint of non-null column in python?

df1: ColumnName Nullable 0 name True 1 Desgn True 2 Emp_number False 3 Salary True df2: name Desgn Emp_number Salary 0 krul 125796 ...
1
vote
0answers
15 views

Pickling classes with circular reference behaves differently based on protocol

If the __qualname__ of a class is set to have a circular reference to itself, pickle behaves differently based on protocol. Following script demonstrates the issue: from __future__ import ...
0
votes
0answers
30 views

How to check column whether it is null-able or not from two different table and then do the process?

df1: name job id_number Salary 0 krul 125796 45000 1 arnold lawyer 789632 25000 2 daisy engg 256498 3 alex 456985 65884 4 ...
0
votes
1answer
16 views

Python: Sort list using substring

I am tying to sort a list of urls on the basis of a keyword. I have tried cmp and key argument, but none is working for me. l = ['KFC/l1', 'KFC/l2', 'KFC/p1', 'KFC/p2'] def match_score(sentence): ...
0
votes
2answers
38 views

Removing rows from a dataframe, if the observation for a specific variable is numeric

data example I have a large data frame with over 20000 observations, I have a variable called “station” and I need to remove all rows that only have numbers as the s station name. The only code that ...
0
votes
1answer
15 views

Python script for downloading data from instrument internal memory through browser

I have to download data from an instrument by connecting LAN wire directly. After that I have to open the web browser and log into instrument Settings by entering a particular IP address. Eventhough ...
0
votes
2answers
20 views

Converting xml data into list of dictionaries to load into tables

I have written a code to convert xml data into list of dictionaries and load into tables. Input file data: <report> <report_header type='comp1' title='industry' year='2019' /> ...
0
votes
1answer
22 views

Decimal representation of a whole number is of lower size than the whole number itself?

In python, Why does the decimal representation of same number shows to occupy lesser space in memory(almost half)? sys.getsizeof(1234561111111111111111111111111111111111111112223567744.0) 24 sys....
0
votes
2answers
20 views

Python2 porting to Python3: ConfigParser Exceptions - AttributeError on MissingSectionHeaderError

I'm attempting to port a Python2.7 script to Python3.6+ and have hit a roadblock my google searching couldn't resolve. The issue is that a try: except: call below doesn't appear to work after doing ...
-1
votes
0answers
10 views

Error while executing a command pip install MySQL-python

Error while executing a command pip install MySQL-python Find the error message below. How can I install MySql-python in Eclipse? - MAC BOOK
0
votes
0answers
27 views

For loop with if-else and break runs on Python 3.7, but not on Python 2.7 [duplicate]

The following code works with the expected result on Python 3.7, but when I ran it on Python 2.7 the break condition doesn't work properly: import math freq_sum = 2888 l = [] target = 404 freq_list =...
0
votes
3answers
87 views

convert content of text file to json in python

I am new bee to python I need your help/suggestion, I am trying to convert the content of text file to json using python filename is json_content.txt. Below is the content of text file hostname : ...
0
votes
2answers
40 views

How to import .sh file from another directory in python

I have a .sh script under directory /me/app/environment/env_param.sh Which holds few variables(trying to export) as export username = "uname" export pw = "password" . . . And a python script under ...
1
vote
1answer
23 views

Splunk Python SDK API job.results limited to 50k results. Trying to set an offset to pull multiple chunks of 50k but don't know how to get it to work

I have a job who's job['resultCount'] is 367k, but no matter what I do, I can't seem to pull more than the first 50,000 chunk. I read this chunk of code off of an answer here for someone who had a ...
0
votes
1answer
41 views

Any changes in 'functools.lru_cache' from python 2 and python 3?

My code is here works fine in python2.7 but fails inpython 3 functools.lru_cache(maxsize=32) any change in from python 2 to python 3. The error I am getting is for my configparser object while ...
0
votes
0answers
10 views

How to heapify a list of objects on the basis of objects's property? [duplicate]

I am trying to create a minimum heap of a list of object using the following code, import heapq class my_obj: def __init__(self, value_passed, other_value_passed): self.value = ...
-5
votes
1answer
45 views

Is there a simpler way to solve the problem Using python

Python problem : use simulations to estimate the probability that two out of N people in a room share the same birthday. It is guaranteed that 2 <= N <= 30. This is kind of an example : import ...
-1
votes
0answers
26 views

Converting multiple XML files into dict and load to tables using Python [closed]

I have different xml file like 1.xml, 2.xml, 3.xml need convert into 1.csv,2.csv, 3.csv. XML data will be like as below <report> <report_header type='comp1' title='industry' year='2019'...
0
votes
1answer
58 views

Need to add/delete key-val, if key doesn't exists for nested dictionary of variables depth

I've two nested dictionaries of variable depth orig_dict , new_dict orig_dict = {"a":1, "b":[{"c":{"d":2}, "e":[{"q":12}, {"a":2}]}, {"h":[1,2,3,4]}], "e":{"we":12}} new_dict = {"a":2, "b":[{"c":{"d":...
2
votes
0answers
41 views

A* find path to Maze1, 2, 3

I'm trying to code an algorithm that finds the path of the Mazes using the A* Algo. But I'm not getting the path when I print it. What's wrong? this is what I have: basic_operations = 0 def ...
0
votes
2answers
55 views

upgrading from python2.7 to python3.7 in google app engine and ndb datastore

We have an existing application on Python 2.7 on Google app engine standard. We are planning to migrate the application to python 3.7 because of end of support for python 2.7. We use ndb library to ...
0
votes
1answer
29 views

How to assign multiple variables in a loop

Hello I'm fairly new to python but I'm trying to figure out how to assign multiple variables (in this case name and an ID number) that's already inside of a loop. This is the example of the loop as I'...
-1
votes
2answers
64 views

How can I write two functions next to each other in python?

[hi everyone I have an issue and I just cant't solve it :( this is my code and I want my output to look like in the image that I uploaded. Thanks everyone]1 def celiusToFahrenheit(): print("Celsius\...
2
votes
1answer
44 views

Calling instance method from class method, allowed in python3, disallowed in python 2?

The following code snippet gives error in python2 but no error with python3 class Steps(object): def step(self, msg="Default"): if not hasattr(self, "funky_attr"): print('No ...
0
votes
2answers
43 views

Python built-in functions for class object?

I'm new to python. I've heard that everything is an object when it comes to python even if class or function. As far as I know, the class object is created when the program starts. So I wonder if ...
-1
votes
0answers
24 views

array oriented coding for python?

Help with array oriented coding for python? Hello all, i am looking for some way to store labels and inputs into a single array, something that goes around these lines Global Label[20] #initialize ...
0
votes
1answer
39 views

Issue with python encoding and json.dumps()

I want to store heading tags into mysql, I need to store from different languages (e.g. english, persian, arabic and etc) For example my string must be something like below: {"h1": "زبان فارس - ...