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,610 points
1,121 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,050 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,870 points
296 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
3,918 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 4,834 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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,033 views
0 votes
0 answers
+4 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,556 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,050 points
2,218 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,050 points
211 views