Comments (6)
Does Python automatically materialize all the properties when the class is created? If yes, I definitely agree we shouldn't create "values" eagerly ...
from koalas.
Yes, it does.
Here is an example. I implemented values
as property in _Frame
class.
@property
def values(self):
return self.toPandas().values
Running this code will show us that the property values
contains already the data as numpy array.
df = pd.DataFrame({'a': [4, 2, 3, 4, 8, 6],
'b': [1, 2, 9, 4, 2, 4],
'c': ["one", "three", "six", "seven", "one", "5"]},
index=[10, 20, 30, 40, 50, 60])
ddf = self.spark.from_pandas(df)
A screen capture from the debugger stopped after creating ddf
from koalas.
A debugging tool would typically get all attributes in dir() and request for every attribute. Checking it in a debugger may not be an accurate test
from koalas.
@AbdealiJK
Thanks! You are right, it's not an accurate test.
I tried it with this simple test, and the message doesn't appear when we create the dataframe.
@property
def values(self):
print("executed !")
return self.toPandas().values
from koalas.
So, we can say that properties are lazy by default!
from koalas.
Thanks. Looks like we are safe here. I'm going to close this ticket. Feel free to reopen if there is an issue in the future.
from koalas.
Related Issues (20)
- convert_dtypes support HOT 2
- Koalas vs Pandas HOT 3
- Series.to_json(orient='records') does not return records-based JSON HOT 3
- Write custom metadata to output files with dataframe.to_parquet? HOT 1
- read_excel's parameter - mangle_dupe_cols is used to handle duplicate columns but fails if the duplicate columns are case sensitive. HOT 2
- Predicate Pushdown not Working HOT 3
- AttributeError: module 'databricks.koalas' has no attribute 'DateOffset' HOT 1
- Whether the `apply` function is implemented using the pandas_udf function? HOT 1
- missing function `koalas.series.apply` HOT 1
- Joining koalas frame with spark HOT 2
- fillna does not work with decimals HOT 1
- pyspark is not required when install koalas
- data type conversion error HOT 1
- pyspark dataframe coverting to koalas dataframe have different elements HOT 5
- Spammed with FutureWarnings that are unfilterable
- Koalas.idxmin() is not picking the minimum value from a dataframe, but pandas.idxmin() gives HOT 1
- Attribute Error: module 'numpy' has no attribute 'bool' HOT 3
- Is koalas still being worked on? or is the project on pause at the moment? HOT 2
- gotImport Error
- Erro XVPL formula!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koalas.