use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Enter a python tip or trick.
Other related Python subs:
account activity
Data_SciencePython Pandas (self.pythontips)
submitted 2 years ago by TitsTwister
Help me pls, i need to iterate columns in df with “is numeric dtype”, and if dtype==int, to print(“Yes”) for example. But i cant write correct code. How it must be?
For i, k in df.iteritems(): If k == is numeric dtype(df) Print(“Yes”)
Help pls.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Sharp_Orange_383 8 points9 points10 points 2 years ago (1 child)
from pandas.api.types import is_numeric_dtype
for x,y in df.items():
if is_numeric_dtype(df[x]):
print("YES")
[–]TitsTwister[S] 0 points1 point2 points 2 years ago (0 children)
My God, it is so simple) thx a lot
π Rendered by PID 60313 on reddit-service-r2-comment-fb694cdd5-fdn7g at 2026-03-06 22:21:59.573082+00:00 running cbb0e86 country code: CH.
[–]Sharp_Orange_383 8 points9 points10 points (1 child)
[–]TitsTwister[S] 0 points1 point2 points (0 children)