Friday, 15 January 2010

python - Combining two parts of Dataframes: "ValueError: array length 1 does not match index length 586" -


I am trying to create a new data frame from some previous dataframe which I have met with CSV and calculates something on something Like

  addtest = pd.DataFrame ({'coordinate': 123456, 'level1': rain delay, 'coordinate 1': 789, 'level2': rainD2.level})  

In the above example, level1 and level2 are the levels imported from a single CSV, without any that have been applied to them, and I Get a new data frame without any help Of course, although the beginning and end dates in the level of 2 separate CSV files are different (which is deliberate).

However, if I try "identical" in my entire script, errors

  traceback (the most recent call final) Along with: File "Standardization_Loop_Package", Line 365, & lt; Module & gt; 'SGW_month': Yearlist_sorted.level}) file "/usr/lib64/python2.7/site-packages/pandas/core/frame.py", in line 383, in __init__ mgr = self._init_dict (data, index, column, Dtype = dtype) file "/usr/lib64/python2.7/site-packages/pandas/core/frame.py", line 515, in _init_dict dtype = dtype) file "/usr/lib64/python2.7/site- Package / panda / core / frame.py ", line 5263, _arrays_to_mgr index = extract_index (arrays) file in" /usr/lib64/python2.7/site-packages/pandas/core/frame.py ", in line 5325, Extract_index ValueError Enhanced (msg) ValueError: Array length 1 does not match index length 586  

What do I get this error Wants to hana?

What did I do to get there:

  Combined_df = pd.DataFrame ({'coordinates': coordinates, 'SGW_યુयार': RainDGW Level, 'SGW_manthe': earlists_sorted.love})  

edit (see also comments): Coordinates are only numbers, although if I remove that part Yes, I still get an error, although now it has been changed to the condition error: Block size incompatible with mortgage or I first ignored that type? However, according to the tests given below, the level of two dataframes should be fit:

And to ensure that they are not actually matching or duplicate, I RainD_SGW.level and before the yearlist_sorted.level :

  Yearlist_sorted.info () & lt; Class 'pandas.core.frame.DataFrame' & gt; DatetimeIndex: 586 Entries, 1965-12-01 00:00:00 to 2014-09-01 00:00:00 Data Column: Level 586 Value of Non-Values ​​dtypes: float64 (1) None Yearlist_sorted.index. Get_duplicates () & lt; Class' Pendas. Trials Index.datetime index '& gt; Length: 0, Frakk: None, Timezone: None RainD_SGW.info () & lt; Class 'pandas.core.frame.DataFrame' & gt; DatetimeIndex: 586 entries, 1 965-12-01 00:00:00 to 2014-09-01 00:00:00 Data column: Level 586 Value of non-values ​​dtypes: float64 (1) None RainD_SGW.index. Get_duplicates () & lt; Class' Pendas. Trials Index.datetime index '& gt; Length: 0, Freak: None, Timezone: Anyone  

I like it? They are in the same date range in the same size, and they are not suffering from duplicate, so what else is it?

Not sure that I can count it as an answer, but I have a

Anyway, it goes here:

  RainD ['SGW_month'] = erial_sorted rain [[SGW_UYER]] = Rainfall DSGW rain ['coordinate'] = Str (coordinate)  

So instead of trying to create a new dataframe, and I want parts of the data that I have calculated, Award would like to add original Detafrem ( RainD ), and it seems that it is only wise to use the levels of those Diattifarmon.

But it does not look right for me. I'm scared that it will fail, if my data frame is more than just one thing in addition to their index.

In addition to this, I asked the value to be the coordinate string. I thought they were already one, but it seems that I was wrong.


No comments:

Post a Comment