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 in Python by anonymous
• 6,070 points
51 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 by Gitika
• 49,580 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 in Python by Sirajul
• 58,210 points
352 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
2,936 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 in Python by lovelmark
• 160 points
1 flag 3,734 views
0 votes
1 answer
+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 1,561 views
0 votes
0 answers
0 votes
1 answer
+1 vote
8 answers

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

Just for the record: >>> int('55063.000000') Traceback (most recent ...READ MORE

answered Aug 17 in Python by pakainfo
• 200 points
182,175 views
0 votes
1 answer

How to insert an object at a given index in Python?

Hi, @Roshni, I will explain to you with ...READ MORE

answered Jun 23 in Python by Gitika
• 49,580 points
63 views