Итак, если вы поймете это правильно, вот как вы выполняете такого рода итерации с пандами (+ zip):
for url, kwords in zip(df.url, df.keywords):
# the url
# your code here
вы также можете использовать синтаксис, похожий на диктовку, если вам больше нравится: [113 ]
for url, kwords in zip(df["url"], df["keywords"]):
# the url
# your code here
Надеюсь, это ответит на твой вопрос
Что-то вроде этого:
public YourDataTableName GetData()
{
YourDataSet ds = new YourDataSet();
//TODO:Load your data in the set
return ds.YourDataTableName;
}
вы можете обернуть свои данные вокруг общедоступного метода, а затем использовать подпись метода в конструкторе ObjectDataSource. Во время привязки process он выполнит вызов указанного метода, и вы получите свои данные.
прочтите это сообщение в блоге http://www.superedge.net/2010/04/how-to-populate-objectdatasource.html
/// <summary>
/// Gets the data table for object source.
/// </summary>
/// <returns></returns>
public DataSet GetDataTableForObjectSource()
{
// do whatever you want to do here and
// return the table with the data
return MyDataSet.MyTable;
}
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use
/// composition-based implementation to create any child controls
/// they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
base.CreateChildControls();
// in this constructor specify the type name, the class name and
// the public method inside this class where the object datasource will retrieve the data
// make it a signed assembly for security reasons.
var edgeDataSource =
new ObjectDataSource(
"MyNamespace.MyClass, MyNamespace.MyClasss, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ce8ab85a8f42a5e8",
"GetDataTableForObjectSource") {ID = "EdgeDataSource"};
Grid = new SPGridView
{
AutoGenerateColumns = false,
AllowSorting = true,
AllowPaging = true,
AllowFiltering = true,
PageSize = 10
};
// do not use DataSource property. MUST USE DataSourceID with the control name
Grid.DataSourceID = "EdgeDataSource";
// do this before the databind
Controls.Add(edgeDataSource);
Controls.Add(Grid);
// bind the objects and execute the call
//specified in the ObjectDataSource constructor
Grid.DataBind();
}
Надеюсь, это поможет Ура, - Эдж