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,520 points
1,330 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,910 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
6,525 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
7,685 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 18,176 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,061 views
0 votes
1 answer
0 votes
1 answer
+1 vote
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
406,543 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
62,575 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