Skip to main content
se añadieron 1639 caracteres en el cuerpo
Origen Enlace
# get highest QID and start the QID of the appended rows from here
max(int(max_qid = df_qb.QID.astype(dtype = int, errors = 'ignore').max()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8992-9328b27882bc>03bff1b7ef93> in <module>
      1 # get highest QID and start the QID of the appended rows from here
----> 2 max(int(max_qid = df_qb.QID.astype(dtype = int, errors = 'ignore').max()

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\seriespackages\pandas\core\generic.py in wrapperstat_func(self, axis, skipna, level, numeric_only, **kwargs)
  11213   110         if lenreturn self._agg_by_level(name, axis=axis, level=level, skipna=skipna)
  11214         return self._reduce(
> 11215             f, name, axis=axis, skipna=skipna, numeric_only=numeric_only
  11216         ) 
 == 111217 

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\series.py in _reduce(self, op, name, axis, skipna, numeric_only, filter_type, **kwds)
   3889                 )
   3890             with np.errstate(all="ignore"):
-> 3891   111              return converterop(selfdelegate, skipna=skipna, **kwds)
   3892 
   3893         # TODO(EA) dispatch to Index

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\nanops.iloc[0]py in f(values, axis, skipna, **kwds)
    123                     result = alt(values, axis=axis, skipna=skipna, **kwds)
    124             else:
--> 112125         raise TypeError(f"cannot convert the series to {converter}"  result = alt(values, axis=axis, skipna=skipna, **kwds)
    113126 
    114127     wrapper        return result

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\nanops.__name__py in reduction(values, axis, skipna, mask)
    835                 result = f"__{converternp.__name__}__"nan
    836         else:
--> 837             result = getattr(values, meth)(axis)
    838 
    839         result = _wrap_results(result, dtype, fill_value)

C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\_methods.py in _amax(a, axis, out, keepdims, initial, where)
     28 def _amax(a, axis=None, out=None, keepdims=False,
     29           initial=_NoValue, where=True):
---> 30     return umr_maximum(a, axis, None, out, keepdims, initial, where)
     31 
     32 def _amin(a, axis=None, out=None, keepdims=False,

TypeError: cannot'>=' convertnot thesupported seriesbetween toinstances <classof 'int'>'str' and 'float'
# get highest QID and start the QID of the appended rows from here
max(int(df_qb.QID))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-89-9328b27882bc> in <module>
      1 # get highest QID and start the QID of the appended rows from here
----> 2 max(int(df_qb.QID))

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\series.py in wrapper(self)
    110         if len(self) == 1:
    111             return converter(self.iloc[0])
--> 112         raise TypeError(f"cannot convert the series to {converter}")
    113 
    114     wrapper.__name__ = f"__{converter.__name__}__"

TypeError: cannot convert the series to <class 'int'>
# get highest QID and start the QID of the appended rows from here
max_qid = df_qb.QID.astype(dtype = int, errors = 'ignore').max()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-92-03bff1b7ef93> in <module>
      1 # get highest QID and start the QID of the appended rows from here
----> 2 max_qid = df_qb.QID.astype(dtype = int, errors = 'ignore').max()

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in stat_func(self, axis, skipna, level, numeric_only, **kwargs)
  11213             return self._agg_by_level(name, axis=axis, level=level, skipna=skipna)
  11214         return self._reduce(
> 11215             f, name, axis=axis, skipna=skipna, numeric_only=numeric_only
  11216         ) 
  11217 

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\series.py in _reduce(self, op, name, axis, skipna, numeric_only, filter_type, **kwds)
   3889                 )
   3890             with np.errstate(all="ignore"):
-> 3891                 return op(delegate, skipna=skipna, **kwds)
   3892 
   3893         # TODO(EA) dispatch to Index

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\nanops.py in f(values, axis, skipna, **kwds)
    123                     result = alt(values, axis=axis, skipna=skipna, **kwds)
    124             else:
--> 125                 result = alt(values, axis=axis, skipna=skipna, **kwds)
    126 
    127             return result

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\nanops.py in reduction(values, axis, skipna, mask)
    835                 result = np.nan
    836         else:
--> 837             result = getattr(values, meth)(axis)
    838 
    839         result = _wrap_results(result, dtype, fill_value)

C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\_methods.py in _amax(a, axis, out, keepdims, initial, where)
     28 def _amax(a, axis=None, out=None, keepdims=False,
     29           initial=_NoValue, where=True):
---> 30     return umr_maximum(a, axis, None, out, keepdims, initial, where)
     31 
     32 def _amin(a, axis=None, out=None, keepdims=False,

TypeError: '>=' not supported between instances of 'str' and 'float'
Origen Enlace

Agregue un dataframe después de otro pero aumente el índice

Tengo una dataframe original y una otra que me gustaría añadir al primero. Sin embargo, hay una columna con las identificaciones y me gustaría que el marco de datos que las filas del marco de datos que añadimos a ella para aumentar desde el mayor QID de la primera dataframe. Sé como agregar un marco de datos después de otro. Los nombres de las columnas de la segunda se incluyen en la primera.

df_qb.append(dfgrouped)

Hasta hoy intenté obtener el maximo en la columna QID de la dataframe original.

# get highest QID and start the QID of the appended rows from here
max(int(df_qb.QID))

Pero me devuelve:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-89-9328b27882bc> in <module>
      1 # get highest QID and start the QID of the appended rows from here
----> 2 max(int(df_qb.QID))

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\series.py in wrapper(self)
    110         if len(self) == 1:
    111             return converter(self.iloc[0])
--> 112         raise TypeError(f"cannot convert the series to {converter}")
    113 
    114     wrapper.__name__ = f"__{converter.__name__}__"

TypeError: cannot convert the series to <class 'int'>