我有一个叫做'df'的熊猫数据集.
我怎么能做下面这样的事情;
df.query("select * from df")
Run Code Online (Sandbox Code Playgroud)
谢谢.
对于那些了解R的人来说,有一个名为sqldf的库,你可以在R中执行SQL代码,我的问题基本上就是,在python中有一些像sqldf这样的库
我有一个清单:
my_list = ['a', 'b']
Run Code Online (Sandbox Code Playgroud)
和一个 pandas 数据框:
d = {'a': [1, 2], 'b': [3, 4], 'c': [1, 2], 'd': [3, 4]}
df = pd.DataFrame(data=d)
Run Code Online (Sandbox Code Playgroud)
df我可以做什么来删除based on list 中的列my_list,在这种情况下删除列a并b
我试图安装插入包时遇到此错误:
ERROR: compilation failed for package ‘ddalpha’
* removing ‘/home/rspark/R/x86_64-redhat-linux-gnu-library/3.3/ddalpha’
Warning in install.packages :
installation of package ‘ddalpha’ had non-zero exit status
ERROR: dependency ‘ddalpha’ is not available for package ‘recipes’
* removing ‘/home/rspark/R/x86_64-redhat-linux-gnu-library/3.3/recipes’
Warning in install.packages :
installation of package ‘recipes’ had non-zero exit status
ERROR: dependency ‘recipes’ is not available for package ‘caret’
* removing ‘/home/rspark/R/x86_64-redhat-linux-gnu-library/3.3/caret’
Warning in install.packages :
installation of package ‘caret’ had non-zero exit status
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
install.packages("ddalpha")
Run Code Online (Sandbox Code Playgroud)
它给出了同样的错误:
/usr/lib64/R/library/BH/include/boost/exception/exception.hpp:137: error: expected declaration before end of …Run Code Online (Sandbox Code Playgroud) 我有这个:
from io import StringIO
buffer = StringIO()
latest_file = 'C:\\Users\\miguel.santos\\Desktop\\meo_snapshots\\Snapshot_14.jpg'
buffer.write(open(latest_file,'rb').read())
TypeError: string argument expected, got 'bytes'
Run Code Online (Sandbox Code Playgroud)
关于如何解决的任何想法?
我只想转换一个看起来像这样的对象:
dict_values(['baf0242b-d7fc-49d7-aada-220344969fb6'])
Run Code Online (Sandbox Code Playgroud)
我从这样做中得到的:
dictionary.values()
Run Code Online (Sandbox Code Playgroud)
对于一个简单的字符串: 'baf0242b-d7fc-49d7-aada-220344969fb6'
我怎样才能?