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
7,096 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,230 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,850 points
1,562 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
8,133 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 19,291 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 4,406 views
0 votes
1 answer
+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,790 points
4,016 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,230 points
5,930 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,230 points
1,614 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP