How to use 'pandas iloc' in Python

Every line of 'pandas iloc' 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
803def get_loc(self, key, method=None, tolerance=None):
804 """
805 Get integer location for requested label
806
807 Returns
808 -------
809 loc : int
810 """
811 try:
812 return self._engine.get_loc(key)
813 except KeyError:
814 if is_integer(key):
815 raise
816
817 try:
818 asdt, parsed, reso = parse_time_string(key, self.freq)
819 key = asdt
820 except TypeError:
821 pass
822
823 try:
824 key = Period(key, freq=self.freq)
825 except ValueError:
826 # we cannot construct the Period
827 # as we have an invalid type
828 raise KeyError(key)
829
830 try:
831 ordinal = tslib.iNaT if key is tslib.NaT else key.ordinal
832 if tolerance is not None:
833 tolerance = self._convert_tolerance(tolerance,
834 np.asarray(key))
835 return self._int64index.get_loc(ordinal, method, tolerance)
836
837 except KeyError:
838 raise KeyError(key)
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


Related snippets