Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4528#discussion_r24480198
  
    --- Diff: python/pyspark/sql/context.py ---
    @@ -336,19 +353,28 @@ def createDataFrame(self, rdd, schema=None, 
samplingRatio=None):
             >>> df3.collect()
             [Row(name=u'Alice', age=1)]
             """
    -        if isinstance(rdd, DataFrame):
    +        if isinstance(data, DataFrame):
                 raise TypeError("rdd is already a DataFrame")
     
    -        if isinstance(schema, StructType):
    -            return self.applySchema(rdd, schema)
    -        else:
    -            if isinstance(schema, (list, tuple)):
    -                first = rdd.first()
    -                if not isinstance(first, (list, tuple)):
    -                    raise ValueError("each row in `rdd` should be list or 
tuple")
    -                row_cls = Row(*schema)
    -                rdd = rdd.map(lambda r: row_cls(*r))
    -            return self.inferSchema(rdd, samplingRatio)
    +        if has_pandas and isinstance(data, pandas.DataFrame):
    --- End diff --
    
    would it ever be possible in Python for has_pandas to be false, but a 
pandas.DataFrame is passed in?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to