4 examples of 'pandas to_date' in Python

Every line of 'pandas to_date' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
761def convert_month_day_to_date_time(self, df, year = 1970):
762 new_index = []
763
764 # TODO use map?
765 for i in range(0, len(df.index)):
766 x = df.index[i]
767 new_index.append(datetime.date(year, x[0], int(x[1])))
768
769 df.index = pandas.DatetimeIndex(new_index)
770
771 return df
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

33def datesarray_to_datetimearray(dates: np.ndarray) -> np.ndarray:
34 """
35 Convert an pandas-array of timestamps into
36 An numpy-array of datetimes
37 :return: numpy-array of datetime
38 """
39 return dates.dt.to_pydatetime()
528def _convert_date_format(frame, date_format=None):
529 if date_format is not None:
530
531 def _convert(col):
532 if col.dtype.name == "datetime64[ns]":
533 return col.apply(lambda x: x.strftime(date_format))
534 return col
535
536 frame = frame.apply(_convert)
537 return frame
302def to_pandas(self) -> None:
303 '''Return a Pandas Index.
304 '''
305 raise NotImplementedError('Pandas does not support a year month type, and it is ambiguous if a date proxy should be the first of the month or the last of the month.')

Related snippets