Python Forum
Pandas : How to create an algorithm that helps me improve results and creating new co
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas : How to create an algorithm that helps me improve results and creating new co
#5
(Apr-03-2022, 10:47 PM)Larz60+ Wrote: You're getting a bad value exception, but the error message does not look like a complete message.
This is the full error message :
Error:
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-338-9b9ac9bdf42b> in <module> 10 new_col.extend(suffix) 11 ---> 12 df['new'] = new_col ~\anaconda3\lib\site-packages\pandas\core\frame.py in __setitem__(self, key, value) 3038 else: 3039 # set column -> 3040 self._set_item(key, value) 3041 3042 def _setitem_slice(self, key: slice, value): ~\anaconda3\lib\site-packages\pandas\core\frame.py in _set_item(self, key, value) 3114 """ 3115 self._ensure_valid_index(value) -> 3116 value = self._sanitize_column(key, value) 3117 NDFrame._set_item(self, key, value) 3118 ~\anaconda3\lib\site-packages\pandas\core\frame.py in _sanitize_column(self, key, value, broadcast) 3762 3763 # turn me into an ndarray -> 3764 value = sanitize_index(value, self.index) 3765 if not isinstance(value, (np.ndarray, Index)): 3766 if isinstance(value, list) and len(value) > 0: ~\anaconda3\lib\site-packages\pandas\core\internals\construction.py in sanitize_index(data, index) 745 """ 746 if len(data) != len(index): --> 747 raise ValueError( 748 "Length of values " 749 f"({len(data)}) " ValueError: Length of values (2623) does not match length of index (2667)
Reply


Messages In This Thread
RE: Pandas : How to create an algorithm that helps me improve results and creating new co - by Smordy - Apr-04-2022, 08:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Better python library to create ER Diagram by using pandas data frames as tables klllmmm 0 1,414 Oct-19-2023, 01:01 PM
Last Post: klllmmm
Bug New to coding, Using the zip() function to create Diret and getting weird results Shagamatula 6 1,650 Apr-09-2023, 02:35 PM
Last Post: Shagamatula
Sad pandas writer create "corrupted" file freko75 1 3,055 Jun-14-2022, 09:57 PM
Last Post: snippsat
  Helps with reading csv file - 3 methods hhchenfx 4 3,618 May-13-2021, 04:15 AM
Last Post: buran
  I really need help, I am new to python, I am using a book that helps me to learn JaprO 5 3,252 Nov-28-2020, 02:30 PM
Last Post: JaprO
  Search Results Web results Printing the number of days in a given month and year afefDXCTN 1 2,361 Aug-21-2020, 12:20 PM
Last Post: DeaD_EyE
  How to append one function1 results to function2 results SriRajesh 5 3,363 Jan-02-2020, 12:11 PM
Last Post: Killertjuh
  Creating multiple text fies from new url retrieve results wmc326 1 3,216 Jul-13-2017, 10:57 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020