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 ?

Oct 15, 2020 in Python by anonymous
• 10,480 points
1,569 views

1 answer to this question.

0 votes

use numpy  and use .astype(np,int) instead of .astype("int"). you can use index instead of value.

answered Oct 15, 2020 by Gitika
• 65,770 points

Related Questions In Python

0 votes
1 answer

Python: TypeError :Cannot cast Index to dtype int

Try to use numpy  and use .astype(np,int) ...READ MORE

answered Jun 25, 2020 in Python by Sirajul
• 59,230 points
7,110 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,143 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,340 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,434 views
0 votes
1 answer
0 votes
1 answer
+2 votes
10 answers

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

The following are totally acceptable in python: passing ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,560 points
409,221 views
+1 vote
3 answers

How to print one pandas column without index?

There is a slight mistake in what ...READ MORE

answered Mar 28, 2019 in Python by Shri
64,256 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