Home>
The difference between one date value and another date value was taken
There is a column.
The contents are as follows. (There are many missing values, but)
3 NaT
5 NaT
8 NaT
9 NaT
18 NaT
...
8534 27 days 18:46:31
8535 NaT
8547 NaT
8548 156 days 07:19:25
8555 NaT
Extract only date values (for example, 156 of 8548),
We want to delete other data.
So split (), days (), str.split () etc.
I tried it,
Neither series has that attribute
It was played because of that.
I tried reading the official series documentation, but
There wasn't much pinning.
Are there any good ways?
Error message-------------------------------------------- -------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-40-47464bdb491a>in<module>
2 Y = df ['First contact (click time)']
3 sub = X-Y
---->4 sub = pd.to_timedelta (sub, errors = 'coerce'). Days
5 df ['First Time ~ Check-in'] = sub
6 print (df ['First time ~ Check-in'])
c: \ users \ 01037485 \ taishi \ lib \ site-packages \ pandas \ core \ generic.py in __getattr __ (self, name)
5177 if self._info_axis._can_hold_identifiers_and_holds_name (name):
5178 return self [name]
->5179 return object .__ getattribute __ (self, name)
5180
5181 def __setattr __ (self, name, value):
AttributeError: 'Series' object has no attribute 'days'
Applicable source code
X = df ['Check-in date']
Y = df ['First contact (click time)']
sub = X-Y
sub = pd.to_timedelta (sub, errors = 'coerce'). days
df ['first time ~ check-in'] = sub
print (df ['first time ~ check-in'])
-
Answer # 1
-
Answer # 2
You can get it with
Series.dt.days
(notSeries.days
)
Related articles
- python - i want to take 4 edges from the edge image
- python - i want to add a line number to the data frame
- python - i want to combine two dfs
- python - i want to find the mode of a pixel with a pixel value of 1 or more
- python - i want to pass a list as an argument of glob and repeat it
- python - i want to solve this problem
- python - i want the block to disappear when the ball hits the block
- python - i want to handle webdriverchrome ()
- python - i want to move images with pygame
- python - i want to scrape google news, but i can't
- sqlite - [sql] i want to get only the date from the cell that contains the date and time
- python - i want to add an element to a double list
- python - i want to send a list of yahoo news rankings to line
- python - i want to open a file with an absolute path
- how to count days of the week python
- css - i want to specify only the part in svg
- python - i want to know how to keep outputting to csv
- python - i want to avoid line breaks in the file path
- i want to use c ++ code in python
- i want to link vba python files
Related questions
- python : Remove the missed values in the cycle
- python : NUMPY Installation Error
- python : Sophisticated search for coinciding values for several criteria in several DF
- python : Search by Data Pandas Data Panda
- python : It is required to find all the rows with the entry of a given substring.
- python : Change dates in DataFrame
- python : Extraction of data
- python : read_table cuts offices
- python : How to make a beautiful Pandas.DataFrame from XML
- python : How to make a normal output?