Trending questions in Python

0 votes
1 answer

Error in jarvis project (get url)

Hey, @Zodarlxx, Could you please post your error ...READ MORE

Dec 30, 2020 in Python by Gitika
• 65,910 points
542 views
0 votes
0 answers

How to write df to excel without attribute error, and how to add 2 header columns (1 header, 1 units)

Hi, I am very new to Python ...READ MORE

Jun 3, 2020 in Python by Edureka
• 120 points

edited Jun 5, 2020 by Gitika 9,627 views
0 votes
1 answer

How can I use Python to get the system hostname?

Hello @Kartik, Use socket and its gethostname() functionality. This will get the hostname of ...READ MORE

Dec 8, 2020 in Python by Niroj
• 82,880 points
1,446 views
0 votes
1 answer

Why is reading lines from stdin much slower in C++ than Python?

tl;dr: Because of different default settings in ...READ MORE

Dec 18, 2020 in Python by Nikita
1,012 views
0 votes
2 answers

How to Import a module from a relative path?

If i understand your question correct then ...READ MORE

Dec 14, 2020 in Python by Tanja84DK

edited Dec 15, 2020 1,300 views
0 votes
1 answer

ModuleNotFoundError: No module named 'torch'

Hi@akhtar, It seems you don't have a torch ...READ MORE

Jun 24, 2020 in Python by MD
• 95,440 points
8,661 views
0 votes
1 answer

How to get list from pandas DataFrame column headers?

You can get the values as a ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,910 points
756 views
0 votes
1 answer

Object of type ObjectId is not JSON serializable, how to send mongo object as json while return?

Hi, @There, Make sure that your MongoDB instance ...READ MORE

Oct 13, 2020 in Python by Gitika
• 65,910 points
3,823 views
0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

Nov 12, 2018 in Python by Nymeria
• 3,560 points
34,104 views
0 votes
2 answers

This kind of error throwing AttributeError: __enter__

I had recently found its solution and ...READ MORE

Jul 31, 2020 in Python by lokesh
7,525 views
0 votes
1 answer

How to insert a date into MySQL using Python?

Hi@akhtar, You can use the DateTime module to insert a date into ...READ MORE

Jul 15, 2020 in Python by MD
• 95,440 points
7,670 views
0 votes
1 answer

What will be the output of below code and why? x=[1,2,3,4,5] print(x.insert(2,3))

If you write x.insert(2,3) and then print x ...READ MORE

Oct 14, 2020 in Python by Gitika
• 65,910 points
3,727 views
0 votes
1 answer

What is the equivalent of “none” in django templates?

Hello @kartik, None, False and True all are available ...READ MORE

Jul 3, 2020 in Python by Niroj
• 82,880 points
8,164 views
0 votes
1 answer

Pandas df header on 2 row

By default when you import a file, ...READ MORE

Apr 4, 2019 in Python by Yogi
27,842 views
0 votes
1 answer

Hey Does anybody know how to fix the unexpected indent error?

Hello, @Aarohan, As the error message indicates, you ...READ MORE

Dec 28, 2020 in Python by Gitika
• 65,910 points
431 views
0 votes
1 answer

Delete column from pandas DataFrame in python

As you've guessed, the right syntax is del ...READ MORE

Dec 20, 2020 in Python by Gitika
• 65,910 points
758 views
0 votes
1 answer

How to divide one number to another multiple times, untill it will be about 0?

You can do something like this:  while num ...READ MORE

Nov 10, 2020 in Python by Gitika
• 65,910 points
2,460 views
0 votes
1 answer

How to change the width of form elements created with ModelForm in Django?

Hello @kartik, The easiest way for your use ...READ MORE

Jul 29, 2020 in Python by Niroj
• 82,880 points
6,929 views
0 votes
1 answer

invalid literal for int() with base 10 in python

Hello, You can try this simple code: def getSum(n): ...READ MORE

Nov 23, 2020 in Python by Niroj
• 82,880 points
1,876 views
0 votes
1 answer

How can I disable logging while running unit tests in Python Django?

Hello @kartik, Since you are in Django, you ...READ MORE

Jun 23, 2020 in Python by Niroj
• 82,880 points
8,429 views
0 votes
1 answer

Error:Manager isn't accessible via model instances

Hello @kartik, The error caused when you try ...READ MORE

Aug 17, 2020 in Python by Niroj
• 82,880 points
6,058 views
0 votes
2 answers

Recursive Pattern Using Python

n = int(input("please enter your no:")) k = ...READ MORE

Jun 28, 2020 in Python by Shaurya Thapliyal
• 340 points
6,915 views
0 votes
1 answer

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

It seems mysql_config is missing on your ...READ MORE

Dec 4, 2020 in Python by Gitika
• 65,910 points
1,301 views
0 votes
1 answer

How to read a text file into a string variable and strip newlines?

You could use: with open('data.txt', 'r') as file: ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,910 points
449 views
0 votes
1 answer

For Professional window GUI develepoment which python lib/module/framework is best?

HI, @Ganesh, Tkinter is one of the most ...READ MORE

Dec 24, 2020 in Python by Gitika
• 65,910 points
405 views
0 votes
1 answer

How can I remove a trailing newline?

Try the method rstrip() (see doc Python 2 and Python 3) >>> 'test ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
651 views
0 votes
1 answer

How to combine two or more querysets in a Django view?

Hello @kartik, Concatenating the querysets into a list ...READ MORE

Aug 3, 2020 in Python by Niroj
• 82,880 points
6,585 views
0 votes
0 answers

I can't get accurate value in dictionaries in django

Whenever I try to print the dictionaries ...READ MORE

Dec 25, 2020 in Python by Mohamed
• 170 points
355 views
0 votes
1 answer

please what does print_details do in python?

Hi, @There, The print() function prints the specified message to the ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,910 points
402 views
0 votes
1 answer

How do I build a website with referral link on Django?

simple solution.. import hashlib Refferal(Model): user ...READ MORE

Nov 12, 2020 in Python by Gitika
• 65,910 points
2,165 views
0 votes
1 answer

ImportError: cannot import name 'render_to_response' from 'django.shortcuts'

Hello @kartik, The render_to_response shortcut was deprecated in Django 2.0, and ...READ MORE

Jul 2, 2020 in Python by Niroj
• 82,880 points
7,908 views
0 votes
1 answer

how can I save my output of xml parsing in excel file...?

Hi, @Arjmand, I would suggest you go through ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,910 points
380 views
0 votes
1 answer

What does request.user refer to in Django?

Hello @kartik, request.user is User model object. You cannot access ...READ MORE

Jun 23, 2020 in Python by Niroj
• 82,880 points
8,278 views
0 votes
1 answer

Error:Traceback (most recent call last): File "< stdin >", line 1, in ImportError: cannot import name 'path'

Hello @kartik, You need Django version 2 pip install ...READ MORE

Aug 5, 2020 in Python by Niroj
• 82,880 points
6,405 views
0 votes
1 answer

How to remove an element from a list by index?

Use del and specify the index of the element ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
571 views
0 votes
1 answer

How do I remove/delete a folder that is not empty?

import shutil shutil.rmtree('/folder_name') By design, rmtree fails on folder trees containing ...READ MORE

Dec 7, 2020 in Python by Gitika
• 65,910 points
1,071 views
0 votes
1 answer

How do you append to a file in Python?

with open("test.txt", "a") as myfile: ...READ MORE

Dec 20, 2020 in Python by Gitika
• 65,910 points
497 views
0 votes
0 answers

i want to ask that how can i run one file of python in another file in jupyter notebook

motion_detection.ipynb # Python program to implement # Webcam ...READ MORE

Dec 16, 2020 in Python by Ramsha
• 120 points
706 views
0 votes
1 answer

How to find the index of an item in a list?

One thing that is really helpful in ...READ MORE

Dec 3, 2020 in Python by Gitika
• 65,910 points
1,191 views
0 votes
1 answer

i am getting this error "TypeError: tuple indices must be integers or slices, not Database"

Hi, @Shabaj, Regarding your query, I hope this ...READ MORE

Dec 10, 2020 in Python by Gitika
• 65,910 points
911 views
0 votes
1 answer

how easy is yaml to work with in python compared to json?

Hi, First thing YAML and JSON are not ...READ MORE

Dec 16, 2020 in Python by MD
• 95,440 points
639 views
0 votes
1 answer

HI Mr / Mrs I have problem with my jupiter notebook when i try to learn Your video about Machine Learning. Can You help me please ?

Hi@Herlambang, I think you have a 32-bit system. ...READ MORE

Dec 18, 2020 in Python by MD
• 95,440 points
547 views
0 votes
1 answer

AttributeError: 'numpy.ndarray' object has no attribute 'append'

Hi@Nilesh, You have created two empty lists. And ...READ MORE

Aug 11, 2020 in Python by MD
• 95,440 points
6,119 views
0 votes
1 answer

How can I count the occurrences of a list item?

If you only want one item's count, ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
492 views
0 votes
1 answer

How can I print literal curly-brace characters in python string and also use .format on it?

You need to double the {{ and }}: >>> x = ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
461 views
0 votes
1 answer

How to pad zeroes to a string?

Strings: >>> n = '4' >>> print(n.zfill(3)) 004 And for numbers: >>> ...READ MORE

Dec 20, 2020 in Python by Gitika
• 65,910 points
403 views
0 votes
1 answer

How to update Django session variable in javascript?

Hello @kartik, You can do this via Ajax. ...READ MORE

Jul 30, 2020 in Python by Niroj
• 82,880 points
6,525 views
0 votes
1 answer

Meaning of @classmethod and @staticmethod for beginner?

Example class Date(object): def __init__(self, ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
415 views
0 votes
1 answer

Getting the class name of an instance?

Have you tried the __name__ attribute of the class? ie type(x).__name__ will ...READ MORE

Dec 20, 2020 in Python by Gitika
• 65,910 points
359 views