缺⑴份安定

文章 评论 浏览 28

缺⑴份安定 2025-02-12 18:45:06

为了绘制它,通常需要以较长的格式获得数据。 tidyverse - 使用 pivot_longer ,然后 ggplot 看起来像:

df |>
  pivot_longer(-clusters) |>
  ggplot(aes(x = name,
             y = value,
             fill = as.factor(clusters))) +
  geom_col(position = "dodge")

plot:

数据:

df <-
  tribble(
  ~clusters,~neuroticism,~introverty,~empathic,~open,~unconscious,
  1,0.242,1.02,0.511,0.327,-0.569,
  2,-0.285,-0.257,-1.36,0.723,-0.994,
  3,0.904,-0.973,0.317,0.0622,-0.0249,
  4,-0.836,0.366,0.519,0.269,1.00,
  5,0.0602,-0.493,-1.03,-1.53,-0.168
  )

In order to plot it you'd typically need to have the data in a long format. A tidyverse-solution using pivot_longer and then ggplot could look like:

df |>
  pivot_longer(-clusters) |>
  ggplot(aes(x = name,
             y = value,
             fill = as.factor(clusters))) +
  geom_col(position = "dodge")

Plot:

enter image description here

Data:

df <-
  tribble(
  ~clusters,~neuroticism,~introverty,~empathic,~open,~unconscious,
  1,0.242,1.02,0.511,0.327,-0.569,
  2,-0.285,-0.257,-1.36,0.723,-0.994,
  3,0.904,-0.973,0.317,0.0622,-0.0249,
  4,-0.836,0.366,0.519,0.269,1.00,
  5,0.0602,-0.493,-1.03,-1.53,-0.168
  )

如何在r中绘制我的tibble,如下所示?

缺⑴份安定 2025-02-12 06:32:19

没有像以前版本中的“全尾风3.0 CSS库”的概念,因为将版本3中的所有可用变化组合在一起都太大了。这在这里说明了,

因此,必须配置清除设置,现在被称为 content in tailwind。 config.js

因此,默认情况下,如果tailwind找不到任何样式可以添加到输出中,那么它将输出的只是基本文件,这听起来像是当前为您所做的。

There is no concept of a "full tailwind 3.0 css library" like in previous versions, as combining all the variations available in version 3 would be too large. This is explained here, https://tailwindcss.com/blog/tailwindcss-v3#just-in-time-all-the-time

So it is compulsory to configure the purge settings, which is now called content in tailwind.config.js.

So by default, if Tailwind does not find any styles to add to the output, then all it will output is the base files, which is what it sounds like it is currently doing for you.

尾风配置不导出所有CSS

缺⑴份安定 2025-02-12 01:07:10

您在寻找这样的东西吗?

pivot_longer 用于收集一列中的var以启用架子。

library(tidyverse)

tribble(
  ~ID, ~Time, ~Score, ~Var1, ~Var2, ~Var3,
  1, 1, 100, 1, 2, 1,
  1, 2, 150, 1, 2, 1,
  2, 1, 200, 2, 3, 4,
  2, 2, -10, 2, 3, 4,
  2, 3, -70, 2, 3, 4,
  3, 1, 100, 1, 2, 2,
  3, 2, 200, 1, 2, 2
) |> 
  pivot_longer(starts_with("Var"), names_to = "var", values_to = "level") |> 
  ggplot(aes(Time, Score, group = level)) +
  geom_line() +
  facet_grid(level ~ var)

“”

reprex软件包(v2.0.1)

Are you looking for something like this?

pivot_longer is used to collect the vars in one column to enable faceting.

library(tidyverse)

tribble(
  ~ID, ~Time, ~Score, ~Var1, ~Var2, ~Var3,
  1, 1, 100, 1, 2, 1,
  1, 2, 150, 1, 2, 1,
  2, 1, 200, 2, 3, 4,
  2, 2, -10, 2, 3, 4,
  2, 3, -70, 2, 3, 4,
  3, 1, 100, 1, 2, 2,
  3, 2, 200, 1, 2, 2
) |> 
  pivot_longer(starts_with("Var"), names_to = "var", values_to = "level") |> 
  ggplot(aes(Time, Score, group = level)) +
  geom_line() +
  facet_grid(level ~ var)

Created on 2022-06-07 by the reprex package (v2.0.1)

一个图GGPLOT中的多个图形

缺⑴份安定 2025-02-11 23:05:20
function ofInterest(param: {p: DesiredType} & any){
   // now we I'm totally sure that property 'p' exists in param
   ... = param.p
}

诀窍是将 param 定义为所需的特定类型和任何之间的联合。这样,我们始终知道,该参数具有预期属性(IE),而我们仍然给客户端将功能与几乎任何形状的对象一起使用。

function ofInterest(param: {p: DesiredType} & any){
   // now we I'm totally sure that property 'p' exists in param
   ... = param.p
}

The trick is to define param as a union between the desired specific type(s) and any. That way we always know that the parameter have the expected property(ies) while we still give the client some freedom to use the function with objects of almost any shape.

如何强制一种类型声明至少具有一个已知参数,而其余的则未知

缺⑴份安定 2025-02-11 21:48:39

解决 @Alexy的回答,因为他似乎拒绝这样做...

SELECT
  [Portfolio Company Key] AS portfolio_company_id,
  [Quarter Date Key] AS quarter_date_id,
  MAX(IIF([Measure Name] = 'Realized Value', Value, NULL)) AS realized_value,
  MAX(IIF([Measure Name] = 'Unrealized Value', 
  Value, NULL)) AS unrealized_value,
  MAX(IIF([Measure Name] = 'Total Fair Value', Value, NULL)) as total_fair_value,
  MAX(IIF([Measure Name] = 'Multiple', Value, NULL)) as multiple,
  MAX(IIF([Measure Name] = 'Gross IRR%', Value, NULL)) as gross_irr_percentage,
  MAX(IIF([Measure Name] = 'Multiple used in valuation', Value, NULL)) as multiple_used_in_valuation,
  MAX(IIF([Measure Name] = 'Net Financial Debt', Value, NULL)) as net_financial_debt,
  MAX(IIF([Measure Name] = 'Net Financial Debt / EBITDA', Value, NULL)) as net_financial_debt_ebitda,
  MAX(IIF([Measure Name] = 'EV', Value, NULL)) as enterprise_value,
  MAX(IIF([Measure Name] = 'Fund Investment Cost', Value, NULL)) as fund_investment_cost
FROM
  [dbo].[vQIRData]
WHERE
  [MeasureType] = 'Fair Market Valuation'
GROUP BY
  [Portfolio Company Key],
  [Quarter Date Key]
ORDER BY
  portfolio_company_id

请注意; 不同的被删除,逻辑在功能上与使用 pivot 相同,但重复性稍微稍微重复,同时在更复杂的情况下也更加灵活。

Fix to @Alexy's answer, as he seemingly refuses to do so...

SELECT
  [Portfolio Company Key] AS portfolio_company_id,
  [Quarter Date Key] AS quarter_date_id,
  MAX(IIF([Measure Name] = 'Realized Value', Value, NULL)) AS realized_value,
  MAX(IIF([Measure Name] = 'Unrealized Value', 
  Value, NULL)) AS unrealized_value,
  MAX(IIF([Measure Name] = 'Total Fair Value', Value, NULL)) as total_fair_value,
  MAX(IIF([Measure Name] = 'Multiple', Value, NULL)) as multiple,
  MAX(IIF([Measure Name] = 'Gross IRR%', Value, NULL)) as gross_irr_percentage,
  MAX(IIF([Measure Name] = 'Multiple used in valuation', Value, NULL)) as multiple_used_in_valuation,
  MAX(IIF([Measure Name] = 'Net Financial Debt', Value, NULL)) as net_financial_debt,
  MAX(IIF([Measure Name] = 'Net Financial Debt / EBITDA', Value, NULL)) as net_financial_debt_ebitda,
  MAX(IIF([Measure Name] = 'EV', Value, NULL)) as enterprise_value,
  MAX(IIF([Measure Name] = 'Fund Investment Cost', Value, NULL)) as fund_investment_cost
FROM
  [dbo].[vQIRData]
WHERE
  [MeasureType] = 'Fair Market Valuation'
GROUP BY
  [Portfolio Company Key],
  [Quarter Date Key]
ORDER BY
  portfolio_company_id

Note; DISTINCT is removed, and the logic is Functionally identical to using PIVOT, but slightly more repetitive while also being generally more flexible to more complex situations.

使用很多加入来优化此MS SQL查询

缺⑴份安定 2025-02-11 02:38:08

我没有意识到JS需要与QML相同的语法来访问超类的属性。

以下作用很好:

obj.Component.destruction.connect(() => console.log('destruction!'))

I didn't realize JS needs the same syntax as QML for accessing properties of the superclass.

The following works just fine:

obj.Component.destruction.connect(() => console.log('destruction!'))

可以动态连接到动态创建的项目的“破坏信号”

缺⑴份安定 2025-02-10 23:40:13

通常,当嵌套为嵌入变为空白时,使用PDF包含物的页面通常不容易。

因此,您需要在此示例中使用复杂的JS重新渲染。根据我们的两个组合代码,使用简单的嵌入式图像要容易得多。

Its not easy to set a page with PDF inclusions usually when nested PDF as embedment becomes blank.
enter image description here
So you need to fiddle with complex js re-renderings like this example. It would be much easier to use simple embedded images, as per both our combined codes.

enter image description here

用其他文本打印PDF内容?

缺⑴份安定 2025-02-10 19:05:34

如果您需要更精确或较低的睡眠时间,并且在等待时不要介意忙于周期(100%CPU核心使用),请考虑自己制作:

import time

def sleep(duration, get_now=time.perf_counter):
    now = get_now()
    end = now + duration
    while now < end:
        now = get_now()

if you need more precision or lower sleep times, and don't mind busy-cycling (100% cpu core usage) while waiting, consider making your own:

import time

def sleep(duration, get_now=time.perf_counter):
    now = get_now()
    end = now + duration
    while now < end:
        now = get_now()

python的time.sleep()有多准确?

缺⑴份安定 2025-02-10 08:51:49

当您提出疑问时,通过参考文献是一个好习惯。参考文献的目的是“观看”在状态和重建中进行更改,因此,通常,参考文献在窗口小部件的构建内部(commuterWidgets)。

总而言之,我试图弄清楚您为什么需要通过它。

我认为您需要这样的解决方案来阅读其他提供商,对吗?

您只能将裁判作为参数传递,以允许班级阅读其他提供商。通过参考文献,您可以创建参考文献和参考文献。但是,请注意在哪里使用Ref.Watch,因为不建议在提供商本身内使用它。看看RiverPod详细文档在这里

,您可以创建一个从提供者那里获取参考值的类,如下所示:

final createController = Provider((ref) => CreateProvider(ref));

class CreateProvider {

    CreateProvider(this.ref) {
        _init();
    }

    //Init to initialize values
    _init() async {

    }

    //Ref to access other providers
    final Ref ref;

}

拥有Ref,您可以访问在提供商范围内注册的其他提供商。

It is not a good practice to pass the ref.watch as you question. The purpose of ref.watch is to 'watch' for changing at the state and re-build, so, normally the ref.watch goes inside the build of the widgets (ConsumerWidgets).

All in all, I'm trying to figure why you need to pass it.

I figure you need such solution for reading other providers, correct?

You can pass only the ref as an argument to allow the class to read the other providers. Passing the ref, you can create the ref.watch and the ref.read, but, take care where to use the ref.watch because it is not recommended to use it inside the provider itself. Take a look to the Riverpod detailed documentation here

For example, if you create a provider to hold the whole logic of the app, you can create a class that get the ref value from the provider as following:

final createController = Provider((ref) => CreateProvider(ref));

class CreateProvider {

    CreateProvider(this.ref) {
        _init();
    }

    //Init to initialize values
    _init() async {

    }

    //Ref to access other providers
    final Ref ref;

}

Having the ref, you can access other providers registered at the provider Scope.

RiverPod通过Ref.Watch作为争论

缺⑴份安定 2025-02-10 07:29:13

只需添加(单击)=“ Sidenav.toggle()” 在您的 Mat-Sidenav 标签中。都是

Just add (click)="sidenav.toggle()" in your mat-sidenav tags. It's all

通过单击菜单外的角度隐藏侧面

缺⑴份安定 2025-02-10 04:20:50

我看到已经几个月了,但是我遇到了同样的问题,这就是我学到的。

当您编译要调试的C/C ++程序时,您需要在调试模式下编译它,该模式告诉编译器在程序中包含调试符号。如果直接使用GCC编译,则可以使用 -G 标志。但是,我假设您正在使用cmake,在这种情况下,您只需添加 set(cmake_build_type debug)> cmakelists.txt(在这里找到了其他一些选项

可能不用说,但是在以这种方式进行重新编译后,您需要通过握住bootsel按钮并将其直接插入计算机(即,不是通过调试器PICO)来将新程序重新加载到目标PICO中。

我还发现,在执行此操作之后,将断点设置为仍然没有预期的特定行,我也必须实际指定文件的名称,例如: break main.c:15

I see it's been a few months but I just ran into the same problem, here's what I've learned.

When you compile the C/C++ program that you're trying to debug, you need to compile it in debug mode, which tells the compiler to include debug symbols in the program. If compiling directly with gcc, you can use the -g flag. However, I'm assuming you're using CMake, in which case you can just add set(CMAKE_BUILD_TYPE Debug) to your CMakeLists.txt (found a few other options here as well)

Probably goes without saying, but after recompiling this way, you'll need to re-load your new program onto your target Pico by holding the bootsel button and plugging it into your machine directly (ie. not via your debugger Pico).

I also found that after doing this, setting breakpoints just to specific lines still didn't behave as expected, and I had to actually specify the name of the file as well, ex: break main.c:15

debuggin raspberry pi pico加载其他文件?

缺⑴份安定 2025-02-09 14:36:49

在此数据中绘制数据并渲染组件时,您应该考虑到尚未可用或无效的数据的情况。

具体来说,您正在尝试渲染此数据:

  return (
    <div className="weather-feature">
      <h1>hi</h1>
      <p className="location">{weatherData.location.name}</p>
      <p className="temp">{weatherData.current.temp_c}</p>
      <p className="weather-desc">{weatherData.current.condition.text}</p>
    
    </div>

但是它在第一个渲染上不会可用(即 weatherdata 首先没有位置属性,因为您的默认值属性 usestate 值是 undefined )。

有很多方法,您选择的最终取决于您的项目和偏好。

您可以使用“ noreferrer”>可选链接作为一种简单的保护在检查嵌套属性时相对于null引用:

  return (
    <div className="weather-feature">
      <h1>hi</h1>
      <p className="location">{weatherData.location?.name}</p>
      <p className="temp">{weatherData.current?.temp_c}</p>
      <p className="weather-desc">{weatherData.current?.condition?.text}</p>
    
    </div>

或者,如果 weatherdata 还没有准备好,则可以返回其他内容。这种事情的好工具是 swr

import useSWR from 'swr'

function Weather()
{
  const { weatherData, error } = useSWR(weatherUrl, fetcher)

  if (error) return <div>failed to load</div>
  if (!weatherData) return <div>loading...</div>
  return <div>hello {weatherData.location}!</div>
}

作为附带说明,要考虑的事情是您的使用效果依赖项:

  useEffect(() => {

    (
      async function(){
        try {
          const response = await axios.get(weatherUrl);
          setWeatherData(response.weatherData);
        } catch (error) {
          setError(error);
        } 
      }
    )(); 
  }, [])

使用空的依赖性数组,您的效果仅在安装和卸载上运行。如果您希望它基于某些其他变量更改,请将这些变量添加到依赖项数组中。

When pulling data like this and rendering components conditional on that data, you should account for situations in which the data is not yet available or null.

Specifically, you're attempting to render this data:

  return (
    <div className="weather-feature">
      <h1>hi</h1>
      <p className="location">{weatherData.location.name}</p>
      <p className="temp">{weatherData.current.temp_c}</p>
      <p className="weather-desc">{weatherData.current.condition.text}</p>
    
    </div>

But it's not going to available on the first render (i.e. weatherData does not have a location property at first, since your default useState value is undefined).

There are many ways around this, and what you choose ultimately depends on your project and preferences.

You can use optional chaining as a simple protection against null references when checking nested properties:

  return (
    <div className="weather-feature">
      <h1>hi</h1>
      <p className="location">{weatherData.location?.name}</p>
      <p className="temp">{weatherData.current?.temp_c}</p>
      <p className="weather-desc">{weatherData.current?.condition?.text}</p>
    
    </div>

Or you can return something else if weatherData is not ready. A good tool for this kind of thing is swr:

import useSWR from 'swr'

function Weather()
{
  const { weatherData, error } = useSWR(weatherUrl, fetcher)

  if (error) return <div>failed to load</div>
  if (!weatherData) return <div>loading...</div>
  return <div>hello {weatherData.location}!</div>
}

As a side note, another thing to consider is your useEffect dependencies:

  useEffect(() => {

    (
      async function(){
        try {
          const response = await axios.get(weatherUrl);
          setWeatherData(response.weatherData);
        } catch (error) {
          setError(error);
        } 
      }
    )(); 
  }, [])

With an empty dependency array, your effect runs only on mount and unmount. If you want it to run based on some other variable(s) changing, add those variables to the dependency array.

反应,无法读取未定义错误的属性

缺⑴份安定 2025-02-08 23:05:43

我假设您希望您的程序每次运行时都会生成 num Die Thr Ther Thr Ther Thr Ther Ther。您的代码看起来很不成熟(不是灰心),所以我认为您仍在学习。荣誉。

您可以使用以下方式:

import random

def throwDies(num):
    for c in range(num):
        throw = random.randint(1,6) #gets a random number between 1 and 6 inclusive
        print("Throw number %d  is #%d"%(c,throw))

x = int(input("Enter the number of throws to make: "))
throwDies(x)

I assume you want your program to generate num die throws each time you run it. Your code looks quite immature(not a discouragement) so I assume you are still learning. Kudos.

You can use this:

import random

def throwDies(num):
    for c in range(num):
        throw = random.randint(1,6) #gets a random number between 1 and 6 inclusive
        print("Throw number %d  is #%d"%(c,throw))

x = int(input("Enter the number of throws to make: "))
throwDies(x)

我如何重复每次增加代码以增加它

缺⑴份安定 2025-02-08 12:22:00

我重现了您的问题,并出现了同样的错误。我为修复它所做的只是在单击元素之前滚动到元素。
尝试一下

driver.find_element(By.XPATH, "//div[@id=\'Content_C164_Col00\']/div/div/div[2]/div/div/div/div/div/button/span/span/span[3]").click()
driver.find_elements(By.CLASS_NAME, "fxs_c_datepicker_button")[1].click()

actions = ActionChains(driver)

button = driver.find_element(By.CLASS_NAME, "fxs_btn.fxs_btn_cta.fxs_fRight")
actions.move_to_element(button)
button.click()

,我还注意到几秒钟后,网站上出现了弹出窗口。确保单击一个,因为它可能会拦截单击“应用”按钮。

更新:
这是从打开网站到选择日期并单击“应用”按钮的完整代码。

from selenium import webdriver 
from selenium.webdriver.chrome.service import Service 
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))

# Opening browser and maximizing it
driver.get("https://www.fxstreet.com/economic-calendar")
driver.maximize_window()

# Click 'Continue to site'
driver.find_element(By.CLASS_NAME, "fxs_prestitial-continue").click()

# Wait until popup appears and cancel it
driver.implicitly_wait(10)
driver.find_element(By.XPATH, "//button[@id='onesignal-slidedown-cancel-button' and text()='Cancel']").click()

# Click the datepicker button and choose date
driver.find_element(By.XPATH, "//div[@id=\'Content_C164_Col00\']/div/div/div[2]/div/div/div/div/div/button/span/span/span[3]").click()
driver.find_elements(By.CLASS_NAME, "fxs_c_datepicker_button")[1].click()

# Creating actions instance
actions = ActionChains(driver)

# Scrolling to 'Apply' button and clicking it
button = driver.find_element(By.CLASS_NAME, "fxs_btn.fxs_btn_cta.fxs_fRight")
actions.move_to_element(button)
button.click()

I reproduced your problem and had the same error. What i did to fix it is just scroll to the element before clicking it.
Try this out

driver.find_element(By.XPATH, "//div[@id=\'Content_C164_Col00\']/div/div/div[2]/div/div/div/div/div/button/span/span/span[3]").click()
driver.find_elements(By.CLASS_NAME, "fxs_c_datepicker_button")[1].click()

actions = ActionChains(driver)

button = driver.find_element(By.CLASS_NAME, "fxs_btn.fxs_btn_cta.fxs_fRight")
actions.move_to_element(button)
button.click()

I also noticed that after a few seconds a popup appears on the website. Make sure you click that one away as it may intercept the click on the apply button.

Update:
Here's the full code from opening the website to selecting date and clicking the apply button.

from selenium import webdriver 
from selenium.webdriver.chrome.service import Service 
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))

# Opening browser and maximizing it
driver.get("https://www.fxstreet.com/economic-calendar")
driver.maximize_window()

# Click 'Continue to site'
driver.find_element(By.CLASS_NAME, "fxs_prestitial-continue").click()

# Wait until popup appears and cancel it
driver.implicitly_wait(10)
driver.find_element(By.XPATH, "//button[@id='onesignal-slidedown-cancel-button' and text()='Cancel']").click()

# Click the datepicker button and choose date
driver.find_element(By.XPATH, "//div[@id=\'Content_C164_Col00\']/div/div/div[2]/div/div/div/div/div/button/span/span/span[3]").click()
driver.find_elements(By.CLASS_NAME, "fxs_c_datepicker_button")[1].click()

# Creating actions instance
actions = ActionChains(driver)

# Scrolling to 'Apply' button and clicking it
button = driver.find_element(By.CLASS_NAME, "fxs_btn.fxs_btn_cta.fxs_fRight")
actions.move_to_element(button)
button.click()

为什么硒中的命令可以单独起作用,但是如果在脚本中放置硒,则可以找到元素

缺⑴份安定 2025-02-08 10:02:52

一个简单的铅测试将使您在这种情况下要求无效的结果

SELECT *,
        CASE WHEN LEAD(HITS) OVER (PARTITION BY ID ORDER BY HITS) IS NULL THEN 1 ELSE 0 END 'IN&OUT'  
FROM T

意味着此ID没有以后的输入。

A simple lead test will give the result you asked for

SELECT *,
        CASE WHEN LEAD(HITS) OVER (PARTITION BY ID ORDER BY HITS) IS NULL THEN 1 ELSE 0 END 'IN&OUT'  
FROM T

Null in this case means that there is no later entry for this id.

两个列的TSQL-Compare值,然后将0或1添加到同一表的另一列

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文