Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Request:
data['Churn'].value_counts(0)
Output:
0 7963
1 2037
Request:
data['Churn'].value_counts(1)
Output:
0 79.63
1 20.37
Could you please explain how parameters of 1, 0 for value_counts work?
You can find an answer when reading documentation:
value_counts(0)
is the same as:
value_counts(normalize=0)
which is interpreted as:
value_counts(normalize=False)
While 1 is interpreted as True in the opposite case.
That's why.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
Improve this question
how I can How can I do it the other hay around, for example, I want my program to be able to ask me for the value of r1 and vote for the level like this Input is 10000000 and the result is 10001, which would be the level
nivel = 10001 - 1
re = nivel**2
re1 = re *10
print (f"\nnivel 7014 : {re1}")
I don't know how I can solve it
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
Improve this question
I try getgfs to list forecast for tomorrow hourly.
import getgfs
f=getgfs.Forecast("0p25")
print(f)
print(f.times)
f.search("temperature")
print(f)
print(f.times)
res=f.get(["gustsfc"],date_time="20230213 "+"{:02d}".format(x)+":00", lat=42.13551084674774,lon=21.721419433353784)
for x in range(18, 23): #23):
f=getgfs.Forecast("0p25")
res=f.datetime_to_forecast('20230211')
res=f.get(["tcdcaveclm"],date_time="20230214 "+"{:02d}".format(x)+":00", lat=42.13551084674774,lon=21.721419433353784)
print("20230214 "+"{:02d}".format(x)+":00",res.variables["tcdcaveclm"].data[0][0][0])
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
answer=input(print('What s the capital',country,'?'))
RETURN
What s the capital of South Africa ?
None
And I have to put my answer just after the 'none'
You are printing inside the input function and print returns None.
You should do something like this:
country = "Italy"
answer = input(f"What's the capital of {country}? ")
print(answer)
Read the documentation here.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
eg-In this instead of using 21 (a value), I want to use a variable to generalize it
print("{:-^21}".format(".|."*(2*(i+1)-1)))
I want to use something like this
print("{:-^M}".format(".|."*(2*(i+1)-1)))
That can easily enough be done. For example:
M = 40
i = 3
print("{val:-^{width}}".format(width=M, val=".|."*(2*(i+1)-1)))
Outputs:
---------.|..|..|..|..|..|..|.----------
You could also do it with f-strings (note the outer ' because " is used on the inner expression):
print(f'{".|."*(2*(i+1)-1):-^{M}}')
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
card_travel2 - 3 yrslocation_onKolkata
From above string I want to get 2 - 3 yrs which regular expression can I use?
Hope you are looking something like this,
import re
pattern = r'\d+\s+-\s+\d+\s+yrs'
text = 'card_travel2 - 3 yrslocation_onKolkata'
re.findall(pattern, text)
output
['2 - 3 yrs']