Trending questions in Python

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,440 points
499 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,599 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,440 points
848 views
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,880 points
2,333 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,230 points
497 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,440 points
497 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,440 points
432 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
333 views
0 votes
1 answer

Error:pip install mysql-python fails with EnvironmentError: mysql_config not found

Hello @kartik, It seems mysql_config is missing on ...READ MORE

May 5, 2020 in Python by Niroj
• 82,880 points
2,517 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,880 points
2,239 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,440 points
847 views
0 votes
0 answers

how to install kivy module in spyder?

Apr 20, 2020 in Python by amey
• 120 points
3,186 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,046 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
345 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 557 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,880 points
325 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,880 points
2,532 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,018 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 377 views
+1 vote
2 answers

Python convert XLS and XLSX file to csv

XLSX tables are usually created in MS ...READ MORE

Aug 30, 2019 in Python by Mian Tanzeel
17,324 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,910 points
1,296 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
918 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,073 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,880 points
876 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,440 points
618 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
900 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
7,488 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,950 points
13,846 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,880 points
2,346 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
14,403 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,071 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 703 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,262 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,549 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,440 points
1,248 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,086 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 11,668 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,880 points
1,842 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,333 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,317 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,880 points
2,739 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 510 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,880 points
466 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,090 points
28,561 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,880 points
2,662 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,880 points
1,092 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,950 points
15,735 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 15,587 views
0 votes
1 answer

How can we install python modules without root access?

Hii, You can run easy_install to install python ...READ MORE

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

How Can I log a Python error with debug information?

Hii, Using exc_info options may be better, to allow you ...READ MORE

May 27, 2020 in Python by Niroj
• 82,880 points
550 views