text stringlengths 0 2.87M |
|---|
DataFrame shape is: (2, 2) |
Columns: Index(['a_new', 'b'], dtype='object') |
:param df: A pandas DataFrame. |
:param func: A function you would like to run in the method chain. |
It should take one DataFrame object as a parameter and have no return. |
If there is a return, it will be ignored. |
:param args: Optional arguments for `func`. |
:param kwargs: Optional keyword arguments for `func`. |
:returns: The input pandas DataFrame, unmodified. |
""" # noqa: E501 |
func(df.copy(), *args, **kwargs) |
return df<user><kinrel>```python |
def also(df: pd.DataFrame, func: Callable, *args, **kwargs) -> pd.DataFrame: |
"""Run a function with side effects. |
Allows you to run an arbitrary function in the method chain, which |
lets you do things like saving the dataframe to disk midway while |
continuing to modify it afterwards. |
Example: |
>>> import pandas as pd |
>>> df = ( |
... pd.DataFrame({"a": [1, 2, 3], "b": list("abc")}) |
... .query("a > 1") |
... .also(lambda df: print(f"DataFrame shape is: {df.shape}")) |
... .also( |
... lambda df: print(f"Columns: {df.columns}") |
... ) |
... ) |
DataFrame shape is: (2, 2) |
Columns: Index(['a_new', 'b'], dtype='object') |
Args: |
df: A pandas DataFrame. |
func: A function you would like to run in the method chain. |
It should take one DataFrame object as a parameter and |
have no return. If there is a return, it will be ignored. |
args: Optional arguments for `func`. |
kwargs: Optional keyword arguments for `func`. |
Returns: |
The input pandas DataFrame, unmodified. |
""" |
func(df.copy(), *args, **kwargs) |
return df |
```<kinrel><user>Explícame paso a paso la receta para hacer una buena tortilla con patatas y cebolla para 4 personas, por favor<user><kinrel>Claro, aquí está la receta detallada para hacer una buena tortilla de patatas y cebolla para 4 personas: |
Ingredientes: |
4 patatas medianas |
2 cebollas medianas |
8 huevos |
Sal al gusto |
Aceite de oliva |
Pasos: |
Pelamos y cortamos las patatas y las cebollas en rodajas finas. |
Calentamos un poco de aceite de oliva en una sartén amplia y añadimos las patatas y las cebollas. Cocinamos a fuego medio hasta que estén suaves y doradas, aproximadamente 20-25 minutos. |
Batimos los huevos en un tazón con una pizca de sal. |
Añadimos las patatas y cebollas a los huevos batidos y mezclamos bien. |
Limpiamos la sartén utilizada anteriormente y calentamos un poco más de aceite. |
Añadimos la mezcla de huevos, patatas y cebolla a la sartén y cocinamos a fuego medio-bajo hasta que la parte de arriba esté casi cuajada. |
Usando un plato grande, cubrimos la sartén y damos la vuelta a la tortilla para que se cocine el otro lado. |
Cocinamos hasta que la tortilla esté dorada y firmemente cuajada, aproximadamente 5-7 minutos. |
Servimos caliente. |
¡Y listo! Con estos pasos, deberías poder preparar una deliciosa tortilla de patatas y cebolla para 4 personas. ¡Buen provecho!<kinrel><user>Ich habe vor einiger Zeit mit Marie darüber geredet, dass man meistens nur negative Post bekommt. Nun habe ich vor ihr einen netten, lustigen und positiven Brief zu schreiben. Kan... |
ich hoffe, du hast es gut und bist gesund. Ich habe vor einiger Zeit mit dir darüber gesprochen, dass man meistens nur negative Post bekommt. Das hat mich dazu gebracht, dir einen netten, lustigen und positiven Brief zu schreiben. |
Ich denke an dich und wollte dir sagen, wie wundervoll du bist. Du hast mich so oft unterstützt und mich bei meinen Unternehmungen ermutigt, besonders wenn ich etwas Neues ausprobiert habe. Dein Wissen und deine Inspiration haben mir so viel geholfen, dass ich einige meiner Ziele erreicht habe. |
Ich bin dir sehr dankbar dafür und ich hoffe, dass du für deine Bemühungen belohnt wirst. Es ist wichtig, dass wir uns gegenseitig ermutigen, unsere Träume zu verfolgen und immer neue Ziele zu setzen. |
Ich wünsche dir alles Gute und hoffe, dass du deine Träume erfüllst. |
Alles Liebe, [Dein Name]<kinrel><user>Làm sao để từ chối cho vay tiền mà không làm mất lòng bạn?<user><kinrel>Không cho vay thì có thể mất bạn, nhưng cho vay thì có thể mất cả tiền lẫn bạn. Trừ khi bạn của bạn uy tín, đã từng cho và trả tiền vay, bạn chỉ nên cho vay ở con số nhất định trong khả năng tài chính của mình,... |
``` |
python |
Copy code |
import bpy |
# Set the name of the object you want to replace |
object_name = "Cube" |
# Create a new point light |
light_data = bpy.data.lights.new(name="Point Light", type="POINT") |
light_object = bpy.data.objects.new(name="Point Light", object_data=light_data) |
bpy.context.scene.collection.objects.link(light_object) |
# Find all objects with the specified name and replace them with the point light |
for obj in bpy.context.scene.objects: |
if obj.name.startswith(object_name): |
obj_index = obj.pass_index # store the original index of the object for later use |
obj_data = obj.data |
obj_matrix = obj.matrix_world |
bpy.data.objects.remove(obj) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.