Trending questions in Python

0 votes
1 answer

How do I migrate a model out of one django app and into a new one?

Hello @kartik, Try this: from south.db import db from south.v2 ...READ MORE

Aug 12, 2020 in Python by Niroj
• 82,840 points
844 views
0 votes
1 answer

How to secure APIs for Registration and Login in Django Rest Framework?

Hello @kartik, you cannot have an authentication system ...READ MORE

Jun 25, 2020 in Python by Niroj
• 82,840 points
2,881 views
+1 vote
1 answer

Error:<map object at 0x7fa3435f3048> is not JSON serializable

Hello @kartik, map() in Python 3 is a generator ...READ MORE

Jul 3, 2020 in Python by Niroj
• 82,840 points
2,507 views
0 votes
1 answer

can you give an example to get a random sample dictionary?

Check below code thisdict = { "1": ...READ MORE

Nov 25, 2021 in Python by anonymous
553 views
0 votes
1 answer

ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

Hello @kartik, The following code works: >>> from django.template ...READ MORE

Aug 7, 2020 in Python by Niroj
• 82,840 points
993 views
0 votes
1 answer

ImportError Traceback (most recent call last) ImportError: numpy.core.umath failed to import

Hi@akhtar, You need to upgrade your Numpy library. Your ...READ MORE

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

How to debug in Django code?

Hello @kartik, There are a bunch of ways ...READ MORE

Aug 6, 2020 in Python by Niroj
• 82,840 points
1,028 views
+1 vote
1 answer

How can I build multiple submit buttons django form?

Hiii @kartik, You can use self.data in the clean_email method to access ...READ MORE

Jun 26, 2020 in Python by Niroj
• 82,840 points
2,749 views
0 votes
1 answer

Python error "'Series' object is not callable "

Try this: df['ln_returns'] = np.log(df['Close_mid']/df['Close_mid']) df['Close_mid'](1)) doesn't seem to ...READ MORE

Jul 22, 2019 in Python by Greg
17,473 views
0 votes
1 answer

Python error "pandas.errors.ParserError: Error tokenizing data"

Pandas do not take .xlsx files. Rename ...READ MORE

Jun 13, 2019 in Python by Rhea
19,150 views
0 votes
1 answer

How can I set Django Cookies?

Hello @kartik, This is a helper to set ...READ MORE

Aug 12, 2020 in Python by Niroj
• 82,840 points
689 views
0 votes
1 answer

How to set the encoding for the tables' char columns in django?

Hello @kartik, Django does not specify charset and ...READ MORE

Jun 24, 2020 in Python by Niroj
• 82,840 points
2,776 views
0 votes
0 answers

How can I add indexes of similar values from two .csv to each of them?

So I have two csv files: csv1.csv: 2010-12-10, Steve, ...READ MORE

Aug 13, 2020 in Python by Alex
• 120 points
671 views
0 votes
1 answer

ModuleNotFoundError: No module named 'jmxquery'

Hi@akhtar, You need to install this module in ...READ MORE

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

ERROR: google-auth 1.11.0 has requirement setuptools>=40.3.0, but you'll have setuptools 39.0.1 which is incompatible.

This indicates you must update setuptools. Execute ...READ MORE

Jun 25, 2020 in Python by Sirajul
• 59,230 points
2,686 views
0 votes
1 answer

Convert a NumPy array to a tuple in Python.

Hi@akhtar, You can use the tuple keyword in ...READ MORE

Jun 29, 2020 in Python by MD
• 95,460 points
2,477 views
0 votes
1 answer

How to access a module written in Python from C?

Hey, @Roshni: You can access a module written ...READ MORE

Jun 26, 2020 in Python by Gitika
• 65,770 points
2,627 views
0 votes
2 answers

How to create empty pandas dataframe?

To create a simple empty DataFrame, use ...READ MORE

Aug 10, 2020 in Python by Nehal
• 140 points

edited Aug 10, 2020 by Nehal 11,291 views
0 votes
1 answer

Write code to create a list of word lengths for the words in original_str using the accumulation pattern and assign the answer to a variable num_words_list.

Hi,  num_words_list = len(original_str.split()) original_str.split() - split words in ...READ MORE

May 27, 2020 in Python by Niroj
• 82,840 points
3,894 views
0 votes
1 answer

SyntaxError: invalid syntax print worldlists[len(words)]

Hi@akhtar, This syntax will not allow in all ...READ MORE

Jun 30, 2020 in Python by MD
• 95,460 points
2,424 views
0 votes
1 answer

How to set other Inline title in Django Admin?

Hii @kartik, You need to set the values ...READ MORE

Jun 29, 2020 in Python by Niroj
• 82,840 points
2,462 views
0 votes
1 answer

What is the difference between map() and filter() function in python?

The map() function is a type of ...READ MORE

Jun 25, 2020 in Python by Sirajul
• 59,230 points
2,584 views
0 votes
1 answer

How to print colored text in terminal in Python?

Hello @kartik, You can use  Python termcolor module. Usage ...READ MORE

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

How to solve the urllib.error.URLError

Hi@Jefferson, You need to use the read function in your ...READ MORE

Jul 15, 2020 in Python by MD
• 95,460 points
2,587 views
0 votes
1 answer

ERROR: mysql 1018 (HY000): Can't read dir of '.' (errno: 13)

Hello @kartik, You need to set ownership and ...READ MORE

Jun 24, 2020 in Python by Niroj
• 82,840 points
2,546 views
0 votes
1 answer

How to install WordCloud or an equivalent package on Anaconda Python 3.7?

Hey, @Jhonny, Could you please post how did ...READ MORE

May 5, 2020 in Python by Gitika
• 65,770 points
4,699 views
0 votes
1 answer

TypeError: 'Element' object is not subscriptable

Hey Bharti, You can get some idea from ...READ MORE

Feb 18, 2020 in Python by Gitika
• 65,770 points
8,019 views
0 votes
0 answers

I am trying to execute the following python code:

and i get the folloeing error READ MORE

Aug 2, 2020 in Python by cinhaw
• 120 points
833 views
0 votes
0 answers

Error: current transaction is aborted, commands ignored until end of transaction block?

I got a lot of errors with ...READ MORE

Aug 3, 2020 in Python by kartik
• 37,520 points
775 views
0 votes
1 answer

Error: "Module not found" while importing tensorflow in pycharm.

Try the following: Go to Files -> Settings ...READ MORE

Jun 23, 2020 in Python by Sirajul
• 59,230 points
2,478 views
0 votes
1 answer

How can I use Django database layer outside of Django?

Hello @kartik, You just need to configure the ...READ MORE

Jun 24, 2020 in Python by Niroj
• 82,840 points
2,417 views
0 votes
1 answer

How to temporarily disable a foreign key constraint in MySQL?

Hello @kartik, To turn off foreign key constraint ...READ MORE

Jun 23, 2020 in Python by Niroj
• 82,840 points
2,455 views
0 votes
1 answer

Stop while loop and continue click on next page of table

Hey, @Vishal,  Python provides two keywords that terminate ...READ MORE

Aug 3, 2020 in Python by Gitika
• 65,770 points
676 views
0 votes
1 answer

I was written the python program, am getting error message "IndentationError: expected an indented block"

Hi@Thiyagarajan, You have one else block in your ...READ MORE

May 27, 2020 in Python by MD
• 95,460 points
3,556 views
0 votes
1 answer

Error:IntegrityError: (1062, "Duplicate entry '1-1-1' for key 'CSID'")

Hello @kartik, Changing index name in ./manage.py sqlall output. You could ...READ MORE

Jul 3, 2020 in Python by Niroj
• 82,840 points
1,927 views
0 votes
1 answer

How can I enable CORS on Django REST Framework

Hello @kartik, You can do by using a ...READ MORE

Jul 1, 2020 in Python by Niroj
• 82,840 points
2,007 views
0 votes
1 answer

How to make a single legend for many subplots with matplotlib?

Hello @kartik, There is  nice function get_legend_handles_labels() you can call ...READ MORE

May 7, 2020 in Python by Niroj
• 82,840 points
4,378 views
0 votes
0 answers

Python Online Training

Learn Python and master the most adopted ...READ MORE

Aug 7, 2020 in Python by swapna
• 120 points
1 flag 438 views
0 votes
1 answer

Python: Splitting numPY 2 D Array

For splitting the 2d array,you can use ...READ MORE

Jul 15, 2019 in Python by Siri

edited Oct 7, 2021 by Sarfaraz 17,151 views
0 votes
1 answer

what is the use of // operator in Python? Can anyone explain?

Hi, @Roshni, It is a Floor Divisionoperator, which ...READ MORE

Jun 23, 2020 in Python by Gitika
• 65,770 points
2,280 views
0 votes
1 answer

Errors in fields not displaying on Django admin form?

Hiii, Here is how you can see what ...READ MORE

Apr 29, 2020 in Python by Niroj
• 82,840 points
4,657 views
0 votes
1 answer

Python pandas: print all values greater than zero in the dataframe

You can use the following code: df[df > ...READ MORE

May 13, 2019 in Python by Esha
19,870 views
0 votes
1 answer

What is the Python logic to count the number of capital letters in a file?

Hi, You can use this piece of code, ...READ MORE

Jun 26, 2020 in Python by Roshni
• 10,480 points
2,144 views
0 votes
1 answer

Can someone help me make a score everytimes the "star" touch the bottom of the border?

Hello @PetesHacker , I saw you do collision detection ...READ MORE

Jul 30, 2020 in Python by Niroj
• 82,840 points
635 views
+1 vote
1 answer

WindowsError: [Error 126] The specified module could not be found.

Hi@akhtar, You can download the shapely module in ...READ MORE

Jul 13, 2020 in Python by MD
• 95,460 points
1,304 views
0 votes
1 answer

I got expected an indented block error.

Hi, You used one function in your code, ...READ MORE

Jun 16, 2020 in Python by MD
• 95,460 points
2,517 views
0 votes
1 answer

Error:Python3.4 can't install mysql-python

Hello @kartik, You can resolved this by the ...READ MORE

Jun 24, 2020 in Python by Niroj
• 82,840 points
2,137 views
0 votes
1 answer

ValueError: numpy.dtype has the wrong size, try recompiling

Hello @kartik, I found it to be a ...READ MORE

Jun 15, 2020 in Python by Niroj
• 82,840 points
2,522 views
0 votes
1 answer

How to convert a DictProxy object into JSON serializable dict?

Hello, Rather than using a private DictProxy method like _getvalue(), I'd ...READ MORE

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

Python error saying "AttributeError: can't set attribute"

change your code to the following: @x.setter def x(self, ...READ MORE

May 30, 2019 in Python by Imran
19,015 views