Python TypeError Cannot cast Index to dtype int

0 votes
X=citibike.index.strftime("%s").astype("int").reshape(-1,  1)

When I run this line code shows

TypeError :Cannot cast Index to dtype int

Please fix my error ?

Jun 25, 2020 in Python by anonymous
• 19,620 points
1,737 views

1 answer to this question.

0 votes
Try to use numpy  and use .astype(np,int) instead of .astype("int").

This will resolve it.
answered Jun 25, 2020 by Sirajul
• 59,090 points
Thanks. Solved I was using an index instead of value.

Related Questions In Python

0 votes
1 answer

TypeError :Cannot cast Index to dtype int

use numpy  and use .astype(np,int) instead of ...READ MORE

answered Oct 15, 2020 in Python by Gitika
• 65,950 points
492 views
0 votes
1 answer

Python error "TypeError: Cannot compare types 'ndarray(dtype=int64)' and 'str'"

Hey @Ashish, change the emotion_map to the ...READ MORE

answered May 30, 2019 in Python by Mir
4,453 views
0 votes
2 answers

Python error "TypeError: Can't convert 'int' object to str implicitly"

A TypeError can occur if the type ...READ MORE

answered Feb 5, 2020 in Python by lovelmark
• 160 points
1 flag 5,982 views
0 votes
1 answer
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,421 views
0 votes
0 answers
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,818 views
0 votes
2 answers

Is it possible to launch python idle from a virtual environment?

Try running the following code. #!/usr/bin/env python """Simple script ...READ MORE

answered Jun 25, 2020 in Python by Sirajul
• 59,090 points
2,722 views
0 votes
1 answer

How to install pycharm?

PyCharm is one of the most widely ...READ MORE

answered Jun 23, 2020 in Python by Sirajul
• 59,090 points
285 views