Compare files excel

Smith smith at smith.it
Sun Jul 23 04:52:40 EDT 2017


On 22/07/2017 22:21, Albert-Jan Roskam wrote:
> (sorry for top posting)
>> Try:
> df1['difference'] = (df1 == df2).all(axis=1)
> ________________________________

here below there is the mistake :
In [17]: diff = df1['difference'] = (df1 == df2).all(axis=1)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-17-195a2c4caf00> in <module>()
----> 1 diff = df1['difference'] = (df1 == df2).all(axis=1)
/usr/local/lib/python3.5/dist-packages/pandas/core/ops.py in f(self, other)
 1295 def f(self, other):
 1296 if isinstance(other, pd.DataFrame): # Another DataFrame
-> 1297 return self._compare_frame(other, func, str_rep)
 1298 elif isinstance(other, ABCSeries):
 1299 return self._combine_series_infer(other, func)
/usr/local/lib/python3.5/dist-packages/pandas/core/frame.py in 
_compare_frame(self, other, func, str_rep)
 3570 def _compare_frame(self, other, func, str_rep):
 3571 if not self._indexed_same(other):
-> 3572 raise ValueError('Can only compare identically-labeled '
 3573 'DataFrame objects')
 3574 return self._compare_frame_evaluate(other, func, str_rep)
ValueError: Can only compare identically-labeled DataFrame objects


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /