Trending questions in Python

0 votes
1 answer

How do I get the path and name of the file that is currently executing?

Hello @kartik, Since Python 3 is fairly mainstream, ...READ MORE

May 11, 2020 in Python by Niroj
• 82,840 points
2,643 views
0 votes
1 answer

How to manage local vs production settings in Django?

Hello @kartik, In settings.py: try: from local_settings ...READ MORE

Jun 22, 2020 in Python by Niroj
• 82,840 points
826 views
0 votes
1 answer

Convert csv file to NumPy array

Hi @Lina, you can use this: numpy_array = ...READ MORE

May 24, 2019 in Python by Puneet
17,879 views
0 votes
1 answer

How to create one Pytest program?

Hi@akhtar, You need to create a file named test_*.py and ...READ MORE

Jun 24, 2020 in Python by MD
• 95,460 points
751 views
0 votes
1 answer

How to create lambda function inside a list in Python?

Hi@akhtar, The lambda statement can appear in places ...READ MORE

Jun 25, 2020 in Python by MD
• 95,460 points
640 views
0 votes
1 answer

I'm working on a Summer dataset for practice in Python. However I get the below error:

Hi@Pratap, I think to find duplicate values using ...READ MORE

Jun 15, 2020 in Python by MD
• 95,460 points
1,086 views
0 votes
1 answer

Error: import No module name urllib2

Hii, You have to install the modules like bs4, ...READ MORE

May 5, 2020 in Python by Niroj
• 82,840 points
2,833 views
0 votes
1 answer

How to append new data in pandas DataFrame?

Hi@MD, You can use the append function to ...READ MORE

Jun 23, 2020 in Python by akhtar
• 38,260 points
741 views
0 votes
1 answer

Error :on installing matplotlib

Hello @kartik, You had to install libfreetype6-dev and libpng-dev from the repositories. ...READ MORE

May 27, 2020 in Python by Niroj
• 82,840 points
1,872 views
0 votes
0 answers

number of occurrence counting in a string

Write a function called number_of_occurrences that takes ...READ MORE

May 16, 2020 in Python by Anny
• 120 points
2,389 views
0 votes
1 answer

How to reimport an updated package while in Python Interpreter?

Hello, To import an updated package while in ...READ MORE

May 12, 2020 in Python by Niroj
• 82,840 points
2,544 views
0 votes
1 answer

How to set colume as index in Pandas DataFrame?

Hi@akhtar, You can use set_index function in pandas. ...READ MORE

Jun 23, 2020 in Python by MD
• 95,460 points
723 views
0 votes
1 answer

Run a function after keyboard interrupt in python

Below is the code to run a ...READ MORE

Jul 26, 2019 in Python by Shri
15,069 views
0 votes
1 answer

I have trained a model using machine learning algorithm in python , now i want to create a browser extension of that saved model , Is it possible ??

Hi@Shubham, It may possible. When you saved your ML ...READ MORE

Jun 13, 2020 in Python by MD
• 95,460 points
1,131 views
0 votes
0 answers

TypeError: descriptor 'strftime' requires a 'datetime.date' object but received a 'str'

def dt_to_str(date, fma='%Y-%m-%d'):     """     Converts a datetime object to ...READ MORE

Mar 4, 2020 in Python by anonymous
• 120 points

recategorized Mar 4, 2020 by Gitika 5,492 views
0 votes
1 answer

How to use one URL in Python code?

Hi@akhtar, You can use the requests module in ...READ MORE

Jun 24, 2020 in Python by MD
• 95,460 points
626 views
0 votes
1 answer

timedelta in years

Use the following piece of code: x1=datetime.timedelta(days=3000, seconds=0, ...READ MORE

Aug 8, 2019 in Python by Wajiha
• 1,960 points
14,449 views
0 votes
1 answer

Can anyone help to write a regular expression to fetch TEST:31275 from the below text?

Try using the following expression: Grep -o "TEST:d+" ...READ MORE

Jun 25, 2020 in Python by Nipul Aglawe
525 views
+2 votes
2 answers

What is the difference between print and return in python?

Return statements end the execution of a ...READ MORE

Aug 26, 2019 in Python by anonymous
8,039 views
0 votes
1 answer

Python error "TypeError: 'encoding' is an invalid keyword argument for this function"

Trying using the io module for this ...READ MORE

Aug 2, 2019 in Python by Vaishali

edited Oct 7, 2021 by Sarfaraz 14,675 views
0 votes
1 answer

How to delete items from a dictionary while iterating over it?

Hii Kartik, You could do it in two ...READ MORE

Apr 30, 2020 in Python by Niroj
• 82,840 points
2,880 views
0 votes
1 answer

python JSON only get keys in first level

You just need a simple .keys() >>> dct ...READ MORE

Jan 22, 2019 in Python by SDeb
• 13,300 points
22,883 views
0 votes
0 answers

For some reason i cannot click on this element/button and have been trying for hours PLEASE HELP!!

from selenium import webdriver from selenium.webdriver.chrome.options import Options from ...READ MORE

Jun 18, 2020 in Python by Justin
• 140 points

reshown Jun 18, 2020 by Sirajul 767 views
0 votes
1 answer

How can we install python in RHEL using CLI?

Run the following command: sudo yum install python3 This ...READ MORE

Jun 23, 2020 in Python by Tanay Singh
488 views
0 votes
1 answer

Change the window background color using turtle - python

Try this: import turtle #set up the screen wn = ...READ MORE

Jun 19, 2019 in Python by Faiza
16,445 views
0 votes
2 answers

How do I access command line arguments in Python?

import sys print(sys.argv) More specifically, if you run python example.py ...READ MORE

Jun 25, 2020 in Python by Karan
1,279 views
+1 vote
2 answers

Cannot install tensorflow on 32-bit Python

Unfortunately tensorflow is not supported on 32 ...READ MORE

Jan 13, 2020 in Python by jaakko
• 160 points

edited Apr 18, 2022 by Sarfaraz 12,293 views
0 votes
1 answer

HTML to RTF string using Pandoc(pypandoc)

Hey, @There, Actually there is a simple solution: use ...READ MORE

May 27, 2020 in Python by Gitika
• 65,770 points
1,588 views
0 votes
1 answer

How do I integrate Ajax with Django applications?

Hello @kartik, You don't have to change your ...READ MORE

Jun 22, 2020 in Python by Niroj
• 82,840 points
431 views
0 votes
1 answer

How to use a dot “.” to access members of dictionary?

Hello @kartik, If you want to pickle your ...READ MORE

Apr 30, 2020 in Python by Niroj
• 82,840 points
2,651 views
0 votes
0 answers

How to do proper formatting of XML differences in dictionary using python 3.4.4

Need help in formatting the output. Please ...READ MORE

Jun 19, 2020 in Python by Abhinandan
• 120 points

edited Jun 19, 2020 by Abhinandan 532 views
0 votes
1 answer

I can't get a graph out of my information

Hi@lzzy, According to your error, there is a ...READ MORE

Jun 11, 2020 in Python by MD
• 95,460 points
836 views
0 votes
1 answer

How to make a flat list out of list of lists?

Hello @kartik, You can use itertools.chain(): import itertools list2d = [[1,2,3], ...READ MORE

Jun 5, 2020 in Python by Niroj
• 82,840 points
1,078 views
0 votes
1 answer

How change title bar background color in python tkinter?

You cant change colour cause its the ...READ MORE

Jun 10, 2020 in Python by bezlin
8,966 views
0 votes
0 answers

hello world, somebody can help me to correct this error

for label, value in s.iteritems():     s.set_value(label, ...READ MORE

Jun 6, 2020 in Python by WELL
• 140 points
1,071 views
0 votes
2 answers

Extracting data from a JSON file in Python

Here is what i found and was ...READ MORE

Nov 27, 2018 in Python by Rupali
29,709 views
0 votes
0 answers

Load and pre-process NSL_KDD data set

since I am a newbie in python ...READ MORE

May 27, 2020 in Python by arezoo
• 220 points
1,369 views
0 votes
1 answer

Python Error saying "NameError: global name 'true' is not defined"

It's a very small mistake. Change true ...READ MORE

Jun 17, 2019 in Python by Vinayak

edited Oct 7, 2021 by Sarfaraz 16,196 views
0 votes
0 answers

What does NameError: name 'withdrawal' is not defined mean ?

READ MORE

Jun 6, 2020 in Python by Shanice
• 120 points

recategorized Jun 8, 2020 by Gitika 893 views
0 votes
1 answer

How to convert dictionary to JSON?

Hello @kartik, json.dumps() returns the JSON string representation of ...READ MORE

Apr 15, 2020 in Python by Niroj
• 82,840 points
3,074 views
0 votes
1 answer

How to pretty-print a numpy.array without scientific notation and with given precision?

Hii @kartik, The numpy arrays have the method round(precision) which ...READ MORE

Apr 14, 2020 in Python by Niroj
• 82,840 points
3,095 views
+1 vote
1 answer

How to save graph using matplotlib library?

Hi@akhtar, You can find one function called savefig ...READ MORE

May 21, 2020 in Python by MD
• 95,460 points
1,438 views
0 votes
1 answer

How to check if a website allows web scraping?

To check if a website allows web ...READ MORE

Jun 14, 2019 in Python by Wajiha
• 1,960 points
16,237 views
0 votes
0 answers

TypeError: only size-1 arrays can be converted to Python scalars

This is my code for key in bboxes: bbox ...READ MORE

May 19, 2020 in Python by Rumia
• 120 points

edited May 19, 2020 by Gitika 1,594 views
0 votes
1 answer

How to send email via Django?

Hello @kartik, I use Gmail as my SMTP ...READ MORE

May 6, 2020 in Python by Niroj
• 82,840 points
2,055 views
0 votes
1 answer

Create a constant in Python?

No there is not. You cannot declare ...READ MORE

Aug 24, 2018 in Python by Priyaj
• 58,020 points
28,875 views
0 votes
1 answer

How to convert one list into generator?

Hi@akhtar, Say, you have one list A. Now convert ...READ MORE

Apr 23, 2020 in Python by MD
• 95,460 points
2,547 views
0 votes
1 answer

Error:Pip install Matplotlib error with virtualenv

Hello @kartik, To generate graph in png format ...READ MORE

May 20, 2020 in Python by Niroj
• 82,840 points
1,362 views
0 votes
1 answer

How to print the full traceback without halting the program?

Hello @kartik, When you don't want to halt ...READ MORE

Jun 5, 2020 in Python by Niroj
• 82,840 points
613 views
0 votes
0 answers

for label, value in s.iteritems(): s.set_value(label, value+2) s.head()

READ MORE

Jun 6, 2020 in Python by WELL
• 140 points

recategorized Jun 8, 2020 by Gitika 625 views