0

Good night, could you do me the favor of how I change this code so that the user enters the 250 data and does not do a random.

data=pd.DataFrame(np.random.randn(250)) data.plot()

1st Nov 2020, 11:37 PM
Astrid
Astrid - avatar
5 ответов
+ 11
Luisa , if I understand you right, you want the user to input 250 data? If yes, you can try: inp = [] num = int(input('how many numbers to input: ')) for i in range(num): temp = input(f'enter the {i+1}. number: ') if temp.isdigit(): inp.append(int(temp)) else: break print(inp) Then use the list inp, and read it in pandas.
2nd Nov 2020, 12:12 PM
Lothar
Lothar - avatar
+ 1
Lothar you are probably right. Mine just asks the user how many random numbers he wants
2nd Nov 2020, 12:36 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 1
Lothar, thanks I'll try
2nd Nov 2020, 1:30 PM
Astrid
Astrid - avatar
+ 1
Thanks Benjamin
2nd Nov 2020, 1:30 PM
Astrid
Astrid - avatar
0
data=pd.DataFrame(np.random.randn(int(input()))) data.plot()
2nd Nov 2020, 2:37 AM
Benjamin Jürgens
Benjamin Jürgens - avatar