Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3
It may help if you print out the variable 'dt' as it is just before the error, and then look at how you are trying to retrieve the data from dt, what you actually expect to get from it. Then fix your indexing/slicing accordingly.
20th Feb 2022, 11:19 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
for i in btdata.shape[0]: the shape property of a pandas dataframe returns a tuple of integers of the dimensions of that dataframe. Therefore the 0th index of the shape property will be an int of the size of that dimension. An int is not a iterable type. This is why you're receiving the error here.
20th Feb 2022, 10:13 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Kyle Y Parsotan You may have several issues throughout your programs. It may be best if you try to solve your errors and issues. Think about what the error means, look it up (Google) if unsure, and where it is pointing you toward. Line 33 is meaningless to me (for the most part), as the shared code doesn't match up with the given lines and I can't run this code to check its operation. I could easily infer the last error and could probably figure this error out if I wished to, but I feel it more important for you to make a more asserted attempt at solving the issue(s). If after you have searched and attempted to learn what the error(s) are and can describe the issue more thoroughly, provide your current version of your code as is without modification along with the error, so that the information is relative, I'll then do my best to help further.
20th Feb 2022, 10:51 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
This is what I found when I Googled 'python invalid index to scalar variable' https://codesource.io/how-to-solve-invalid-index-to-scalar-variable/ Give it a read through and see how it may correlate to your error and line 33 etc.
20th Feb 2022, 11:13 PM
ChaoticDawg
ChaoticDawg - avatar