Merge Series and/or DataFrames together.

    Returns a DataFrame.
160245
def merge(*series):
    
    dfs = []
    for s in series:
        if isinstance(s, pd.DataFrame):
            dfs.append(s)
        elif isinstance(s, pd.Series):
            tmpdf = pd.DataFrame({s.name: s})
            dfs.append(tmpdf)
        else:
            raise NotImplementedError('Unsupported merge type')

    return pd.concat(dfs, axis=1)
965980
def to_dataframe(self, **kwargs):
        """"""
        return pandas.io.parsers.read_csv(self.path, sep=self.d, **kwargs)
81260
def index_row(a:Union[Collection,pd.DataFrame,pd.Series], idxs:Collection[int])->Any:
    ""
    if a is None: return a
    if isinstance(a,(pd.DataFrame,pd.Series)):
        res = a.iloc[idxs]
        if isinstance(res,(pd.DataFrame,pd.Series)): return res.copy()
        return res
    return a[idxs]
857055
def cross_join(df1, df2):
    
    if len(df1) == 0:
        return df2

    if len(df2) == 0:
        return df1

    # Add as lists so that the new index keeps the items in
    # the order that they are added together
    all_columns = pd.Index(list(df1.columns) + list(df2.columns))
    df1['key'] = 1
    df2['key'] = 1
    return pd.merge(df1, df2, on='key').loc[:, all_columns]
250385
def merge(self, other):
        """"""
        log.debug('Merging: %s and %s' % (self.serialize(), other.serialize()))
        for k in self.keys():
            for new_item in other[k]:
                if new_item not in self[k]:
                    self[k].append(new_item)
        log.debug('Result: %s' % self.serialize())
        return self
409256
def to_pandas_dataframe(self):
        
        pd_index = self.index().to_pandas_index()
        return pd.DataFrame.from_items(self.collect()).set_index(pd_index)
72269
def trend(self, **kwargs):
        ''''''
        return DataFrame({ name: series.trend(**kwargs) \
            for name, series in self.groups.iteritems() })
1081186
def _conv(self, data):
        """"""
        if isinstance(data, pd.Series):
            if data.name is None:
                data = data.to_frame(name='')
            else:
                data = data.to_frame()
        data = data.fillna('NaN')
        return data
38772
def toDF(self, *cols):
        
        jdf = self._jdf.toDF(self._jseq(cols))
        return DataFrame(jdf, self.sql_ctx)
1224888
def copy(self):
        
        out = type(self)()
        for series in self:
            out.append(series.copy())
        return out
640878
def merge_sources(self, datas):
        
        datas = [data for data in datas if data is not None]

        if len(datas) == 0:
            raise ValueError("Data missing")

        if len(datas) == 1:
            return datas[0]

        if isinstance(datas[0], list):
            if len([x for x in datas if not isinstance(x, list)]) > 0:
                raise TypeError("Unable to merge: List expected")
            base = []
            for x in datas:
                base = base + x
            return base

        if isinstance(datas[0], dict):
            if len([x for x in datas if not isinstance(x, dict)]) > 0:
                raise TypeError("Unable to merge: Dictionnary expected")
            result = {}
            for element in datas:
                for key in element:
                    if key in result:
                        result[key] = self.merge_sources([result[key], element[key]])
                    else:
                        result[key] = element[key]
            return result

        if len([x for x in datas if isinstance(x, (dict, list))]) > 0:
            raise TypeError("Unable to merge: List not expected")

        raise ValueError("Unable to merge: Conflict")
968518
def merge(self, datasets=None, separate_datasets=False):
        """"""
        self.logger.info("merging")
        if separate_datasets:
            warnings.warn("The option seperate_datasets=True is"
                          "not implemented yet. Performing merging, but"
                          "neglecting the option.")
        else:
            if datasets is None:
                datasets = list(range(len(self.datasets)))
            first = True
            for dataset_number in datasets:
                if first:
                    dataset = self.datasets[dataset_number]
                    first = False
                else:
                    dataset = self._append(dataset, self.datasets[dataset_number])
                    for raw_data_file, file_size in zip(self.datasets[dataset_number].raw_data_files,
                                                        self.datasets[dataset_number].raw_data_files_length):
                        dataset.raw_data_files.append(raw_data_file)
                        dataset.raw_data_files_length.append(file_size)
            self.datasets = [dataset]
            self.number_of_datasets = 1
        return self
1343971
def to_pandas_series_rdd(self):
        
        pd_index = self.index().to_pandas_index()
        return self.map(lambda x: (x[0], pd.Series(x[1], pd_index)))
896300
def sum(self, other):
        """"""
        return TimeSeries.merge(
            [self, other], operation=operations.ignorant_sum
        )
12234
def iter_merge(cls, timeseries_list):
        
        # using return without an argument is the way to say "the
        # iterator is empty" when there is nothing to iterate over
        # (the more you know...)
        if not timeseries_list:
            return

        # for ts in timeseries_list:
        #     if ts.is_floating():
        #         msg = "can't merge empty TimeSeries with no default value"
        #         raise KeyError(msg)

        # This function mostly wraps _iter_merge, the main point of
        # this is to deal with the case of tied times, where we only
        # want to yield the last list of values that occurs for any
        # group of tied times.
        index, previous_t, previous_state = -1, object(), object()
        for index, (t, state) in enumerate(cls._iter_merge(timeseries_list)):
            if index > 0 and t != previous_t:
                yield previous_t, previous_state
            previous_t, previous_state = t, state

        # only yield final thing if there was at least one element
        # yielded by _iter_merge
        if index > -1:
            yield previous_t, previous_state
1203617
def merge(cls, tables, fillna=False):
        """"""
        cols = set(itertools.chain(*[table.dtype.descr for table in tables]))

        tables_to_merge = []
        for table in tables:
            missing_cols = cols - set(table.dtype.descr)

            if missing_cols:
                if fillna:
                    n = len(table)
                    n_cols = len(missing_cols)
                    col_names = []
                    for col_name, col_dtype in missing_cols:
                        if 'f' not in col_dtype:
                            raise ValueError(
                                "Cannot create NaNs for non-float"
                                " type column '{}'".format(col_name)
                            )
                        col_names.append(col_name)

                    table = table.append_columns(
                        col_names, np.full((n_cols, n), np.nan)
                    )
                else:
                    raise ValueError(
                        "Table columns do not match. Use fill_na=True"
                        " if you want to append missing values with NaNs"
                    )
            tables_to_merge.append(table)

        first_table = tables_to_merge[0]

        merged_table = sum(tables_to_merge[1:], first_table)

        merged_table.h5loc = first_table.h5loc
        merged_table.h5singleton = first_table.h5singleton
        merged_table.split_h5 = first_table.split_h5
        merged_table.name = first_table.name

        return merged_table
1206417
def add(type, *data)
      df = DataFrame.new({x: data[0], y: data[1], z: data[2]})
      return add_with_df(df, type, :x, :y, :z)
    end